pub struct SluggableConfig {
pub max_length: Option<usize>,
pub max_length_keep_words: bool,
pub method: Option<SlugMethod>,
pub separator: String,
pub unique: bool,
pub unique_suffix: Option<UniqueSuffix>,
pub first_unique_suffix: String,
pub reserved: Option<Vec<String>>,
pub on_update: bool,
pub slug_engine_options: SlugifyOptions,
}Expand description
Fields§
§max_length: Option<usize>The longest slug, in characters: maxLength. None for no limit.
max_length_keep_words: boolCut a long slug at a word boundary instead of mid-word: maxLengthKeepWords.
method: Option<SlugMethod>A custom slug method: method. None uses the slug engine.
separator: StringThe separator between words: separator.
unique: boolMake slugs unique by adding a suffix: unique.
unique_suffix: Option<UniqueSuffix>A custom suffix generator: uniqueSuffix. None adds -2, -3 and so on.
first_unique_suffix: StringThe suffix of the first duplicate: firstUniqueSuffix.
reserved: Option<Vec<String>>Slugs that may not be used; such a slug gets a suffix: reserved.
on_update: boolRegenerate the slug every time the model is updated: onUpdate.
slug_engine_options: SlugifyOptionsThe slug engine’s options: slugEngineOptions.
Implementations§
Source§impl SluggableConfig
impl SluggableConfig
Sourcepub fn from_env(env: &Env) -> Self
pub fn from_env(env: &Env) -> Self
Read the section from the environment, starting from its defaults.
| Field | Variable | Default |
|---|---|---|
max_length | none | |
max_length_keep_words | true | |
method | none | |
separator | "-".to_owned() | |
unique | true | |
unique_suffix | none | |
first_unique_suffix | "2".to_owned() | |
reserved | none | |
on_update | false | |
slug_engine_options | SlugifyOptions::default() |
from_env records invalid values and missing required values in env. Those problems
stop the application from starting.
Trait Implementations§
Source§impl Clone for SluggableConfig
impl Clone for SluggableConfig
Source§impl Debug for SluggableConfig
impl Debug for SluggableConfig
Auto Trait Implementations§
impl !RefUnwindSafe for SluggableConfig
impl !UnwindSafe for SluggableConfig
impl Forget for SluggableConfig
impl Freeze for SluggableConfigwhere
*const ArcInner<dyn Fn(&str, &str) -> String + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&str, &str) -> String + Sync + Send>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<dyn Fn(&str, &str, &[String], &str) -> String + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&str, &str, &[String], &str) -> String + Sync + Send>>: Freeze,
PhantomData<String>: Freeze,
impl Move for SluggableConfig
impl Send for SluggableConfig
impl Sync for SluggableConfig
impl Unpin for SluggableConfig
impl UnsafeUnpin for SluggableConfigwhere
*const ArcInner<dyn Fn(&str, &str) -> String + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&str, &str) -> String + Sync + Send>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<dyn Fn(&str, &str, &[String], &str) -> String + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&str, &str, &[String], &str) -> String + Sync + Send>>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more