pub trait NameBuilderExt: Sized {
// Required methods
fn generate_id(self) -> Self;
fn with_id(self, value: bool) -> Self;
fn extend<I>(self, replace: bool, iter: I) -> Self
where I: IntoIterator,
I::Item: Display;
fn remove_suffix(self, suffix: &str) -> Self;
fn unique_name<T>(self, value: T) -> Self
where T: Display;
fn shared_name<T>(self, value: T) -> Self
where T: Display;
fn or<T>(self, fallback: T) -> Self
where T: NameFallback;
fn or_else<F, T>(self, fallback: F) -> Self
where F: FnOnce() -> T,
T: NameFallback;
fn type_name(self) -> Self;
fn field_name(self) -> Self;
fn content_type_name(self) -> Self;
}Expand description
Helper trait that provides additional builder patterns to the NameBuilder.
Required Methods§
Sourcefn generate_id(self) -> Self
fn generate_id(self) -> Self
Force the builder to generate a unique id.
Sourcefn with_id(self, value: bool) -> Self
fn with_id(self, value: bool) -> Self
Tell the builder to add (true) or not to add (false) the unique id
to the generated name.
Sourcefn extend<I>(self, replace: bool, iter: I) -> Self
fn extend<I>(self, replace: bool, iter: I) -> Self
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.
Sourcefn remove_suffix(self, suffix: &str) -> Self
fn remove_suffix(self, suffix: &str) -> Self
Remove the specified suffix from the builder.
Sourcefn unique_name<T>(self, value: T) -> Selfwhere
T: Display,
fn unique_name<T>(self, value: T) -> Selfwhere
T: Display,
Instruct the builder to create a unique name from the passed value.
This means, that the with_id is automatically
set to false.
Instruct the builder to create a name that is shared between different parts
of the code from the passed value.
This means, that the with_id is automatically
set to true and the generated name has a unique id to be identified.
Sourcefn or<T>(self, fallback: T) -> Selfwhere
T: NameFallback,
fn or<T>(self, fallback: T) -> Selfwhere
T: NameFallback,
If the builder does currently not have a name, the passed fallback is applied.
Sourcefn or_else<F, T>(self, fallback: F) -> Selfwhere
F: FnOnce() -> T,
T: NameFallback,
fn or_else<F, T>(self, fallback: F) -> Selfwhere
F: FnOnce() -> T,
T: NameFallback,
If the builder does currently not have a name, the passed fallback is applied.
Sourcefn field_name(self) -> Self
fn field_name(self) -> Self
Prepare the builder to create a field name.
Sourcefn content_type_name(self) -> Self
fn content_type_name(self) -> Self
Prepare the builder to create a content type name.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.