pub struct NameBuilder { /* private fields */ }Expand description
Default implementation for the NameBuilder trait.
Implementations§
Source§impl NameBuilder
impl NameBuilder
Sourcepub fn new(id: Arc<AtomicUsize>, naming: Box<dyn NamingTrait>) -> Self
pub fn new(id: Arc<AtomicUsize>, naming: Box<dyn NamingTrait>) -> Self
Create a new NameBuilder instance.
The passed id is used to generate unique ids for unnamed types.
Trait Implementations§
Source§impl Clone for NameBuilder
impl Clone for NameBuilder
Source§impl Debug for NameBuilder
impl Debug for NameBuilder
Source§impl NameBuilder for NameBuilder
impl NameBuilder for NameBuilder
Source§fn finish(&self) -> Name
fn finish(&self) -> Name
Finish the current name building and create a
Name from the known
information.Source§fn merge(&mut self, other: &dyn NameBuilderTrait)
fn merge(&mut self, other: &dyn NameBuilderTrait)
Merge the data of the
other name builder into the current name builder.
The passed name builder is of the same type then the current one.Source§fn clone_boxed(&self) -> Box<dyn NameBuilderTrait>
fn clone_boxed(&self) -> Box<dyn NameBuilderTrait>
Create a clone of the current builder and return it as box.
Source§fn has_extension(&self) -> bool
fn has_extension(&self) -> bool
Returns
true if this builder has at least on extension set, false otherwise.Source§fn set_with_id(&mut self, value: bool)
fn set_with_id(&mut self, value: bool)
Instruct the builder to add a unique id to the generated name or not.
Source§fn set_generated(&mut self, value: bool)
fn set_generated(&mut self, value: bool)
Instruct the builder to generated a
Name::Generated if true is passed,
or a Name::Named if false is passed.Source§fn add_extension(&mut self, replace: bool, extension: String)
fn add_extension(&mut self, replace: bool, extension: String)
Add a new
extension to the builder. If replace is set to true, any previous
extension is dropped.Source§fn strip_suffix(&mut self, suffix: &str)
fn strip_suffix(&mut self, suffix: &str)
Remove the specified
suffix from the name and the extensions.Source§fn generate_unique_id(&mut self)
fn generate_unique_id(&mut self)
Force the builder to generate a unique id, that is later used to generate
the name. Read more
Auto Trait Implementations§
impl Freeze for NameBuilder
impl !RefUnwindSafe for NameBuilder
impl !Send for NameBuilder
impl !Sync for NameBuilder
impl Unpin for NameBuilder
impl !UnwindSafe for NameBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<X> NameBuilderExt for Xwhere
X: NameBuilder,
impl<X> NameBuilderExt for Xwhere
X: NameBuilder,
Source§fn generate_id(self) -> X
fn generate_id(self) -> X
Force the builder to generate a unique id.
Source§fn with_id(self, value: bool) -> X
fn with_id(self, value: bool) -> X
Tell the builder to add (
true) or not to add (false) the unique id
to the generated name.Source§fn extend<I>(self, replace: bool, iter: I) -> X
fn extend<I>(self, replace: bool, iter: I) -> X
Add extensions to the builder using the passed iterator
iter. If replace
is set to true any existing extension is dropped before the new ones are
applied.Source§fn remove_suffix(self, suffix: &str) -> X
fn remove_suffix(self, suffix: &str) -> X
Remove the specified
suffix from the builder.Source§fn unique_name<T>(self, value: T) -> Xwhere
T: Display,
fn unique_name<T>(self, value: T) -> Xwhere
T: Display,
Instruct the builder to create a unique name from the passed
value. Read moreInstruct the builder to create a name that is shared between different parts
of the code from the passed
value. Read moreSource§fn or<T>(self, fallback: T) -> Xwhere
T: NameFallback,
fn or<T>(self, fallback: T) -> Xwhere
T: NameFallback,
If the builder does currently not have a name, the passed
fallback is applied.Source§fn or_else<F, T>(self, fallback: F) -> Xwhere
F: FnOnce() -> T,
T: NameFallback,
fn or_else<F, T>(self, fallback: F) -> Xwhere
F: FnOnce() -> T,
T: NameFallback,
If the builder does currently not have a name, the passed
fallback is applied.