From cd26e40fcb0a3b0c2a1d0c72e47dad0ea81a0050 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Mon, 6 Jan 2020 15:41:51 -0800 Subject: [PATCH] Rename `id` to `name`: phase 3 --- examples/Readme.md | 4 ++-- examples/edit.rs | 2 +- examples/mutation.rs | 2 +- src/cursive.rs | 8 ++++---- src/view/finder.rs | 2 +- src/views/stack_view.rs | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/Readme.md b/examples/Readme.md index 8a5f541..dfb6c9c 100644 --- a/examples/Readme.md +++ b/examples/Readme.md @@ -23,7 +23,7 @@ includes greek and japanese characters to show non-ascii support. ## [`edit`](edit.rs) Here we have an `EditView` to get input from the user, and use that input in -the next view. It shows how to identify a view with an ID and refer to it +the next view. It shows how to identify a view with an name and refer to it later. ## [`mutation`](mutation.rs) @@ -83,7 +83,7 @@ This example draws a colorful square to show off true color support. ## [`refcell_view`](refcell_view.rs) -Here we show how to access multiple views concurently through their IDs. +Here we show how to access multiple views concurently through their name. ## [`progress`](progress.rs) diff --git a/examples/edit.rs b/examples/edit.rs index fc6432b..4c8012c 100644 --- a/examples/edit.rs +++ b/examples/edit.rs @@ -26,7 +26,7 @@ fn main() { ) .button("Ok", |s| { // This will run the given closure, *ONLY* if a view with the - // correct type and the given ID is found. + // correct type and the given name is found. let name = s .call_on_name("name", |view: &mut EditView| { // We can return content from the closure! diff --git a/examples/mutation.rs b/examples/mutation.rs index 07611f0..1451fc8 100644 --- a/examples/mutation.rs +++ b/examples/mutation.rs @@ -13,7 +13,7 @@ fn main() { siv.add_global_callback('q', |s| s.quit()); - // Let's wrap the view to give it a recognizable ID, so we can look for it. + // Let's wrap the view to give it a recognizable name, so we can look for it. // We add the P callback on the textview only (and not globally), // so that we can't call it when the popup is already visible. siv.add_layer( diff --git a/src/cursive.rs b/src/cursive.rs index 6e170a8..28f7583 100644 --- a/src/cursive.rs +++ b/src/cursive.rs @@ -15,7 +15,7 @@ use crate::vec::Vec2; use crate::view::{self, Finder, IntoBoxedView, Position, View}; use crate::views::{self, LayerPosition}; -static DEBUG_VIEW_ID: &str = "_cursive_debug_view"; +static DEBUG_VIEW_NAME: &str = "_cursive_debug_view"; // How long we wait between two empty input polls const INPUT_POLL_DELAY_MS: u64 = 30; @@ -287,7 +287,7 @@ impl Cursive { self.add_layer( views::Dialog::around( views::ScrollView::new(views::NamedView::new( - DEBUG_VIEW_ID, + DEBUG_VIEW_NAME, views::DebugView::new(), )) .scroll_x(true), @@ -307,7 +307,7 @@ impl Cursive { /// ``` pub fn toggle_debug_console(&mut self) { if let Some(pos) = - self.screen_mut().find_layer_from_name(DEBUG_VIEW_ID) + self.screen_mut().find_layer_from_name(DEBUG_VIEW_NAME) { self.screen_mut().remove_layer(pos); } else { @@ -592,7 +592,7 @@ impl Cursive { /// Convenient method to find a view wrapped in [`NamedView`]. /// - /// This looks for a `NamedView` with the given ID, and return + /// This looks for a `NamedView` with the given name, and return /// a [`ViewRef`] to the wrapped view. The `ViewRef` implements /// `DerefMut`, so you can treat it just like a `&mut T`. /// diff --git a/src/view/finder.rs b/src/view/finder.rs index 00570cf..37f6bac 100644 --- a/src/view/finder.rs +++ b/src/view/finder.rs @@ -95,7 +95,7 @@ impl Finder for T { /// Selects a single view (if any) in the tree. pub enum Selector<'a> { - /// Selects a view from its ID. + /// Same as [`Selector::Name`]. #[deprecated( note = "`Selector::Id` is being renamed to `Selector::Name`" )] diff --git a/src/views/stack_view.rs b/src/views/stack_view.rs index 893d6e4..18ac286 100644 --- a/src/views/stack_view.rs +++ b/src/views/stack_view.rs @@ -295,12 +295,12 @@ impl StackView { }) } - /// Looks for the layer containing a view with the given ID. + /// Looks for the layer containing a view with the given name. /// - /// Returns `Some(pos)` if `self.get(pos)` has the given ID, - /// or is a parent of a view with this ID. + /// Returns `Some(pos)` if `self.get(pos)` has the given name, + /// or is a parent of a view with this name. /// - /// Returns `None` if the given ID is not found. + /// Returns `None` if the given name is not found. /// /// Note that the returned position may be invalidated if some layers are /// removed from the view.