pub struct Content {
pub attributes: Vec<Attribute>,
pub single_item: Option<String>,
pub display_settings: DisplaySettings,
pub top_level_type: Option<String>,
}Expand description
Struct to store the attributes of a module for formatting.
Fields§
§attributes: Vec<Attribute>List of attributes.
single_item: Option<String>Single item content.
display_settings: DisplaySettingsDisplay settings.
top_level_type: Option<String>Top level type name.
Implementations§
Source§impl Content
impl Content
Sourcepub fn new(display_settings: DisplaySettings) -> Self
pub fn new(display_settings: DisplaySettings) -> Self
Sourcepub fn add_single<T: ModuleDisplay + ?Sized>(self, value: &T) -> Self
pub fn add_single<T: ModuleDisplay + ?Sized>(self, value: &T) -> Self
Sourcepub fn add_formatted<T: Display>(self, value: &T) -> Self
pub fn add_formatted<T: Display>(self, value: &T) -> Self
Sourcepub fn optional(self) -> Option<Self>
pub fn optional(self) -> Option<Self>
A convenience method to wrap the Attributes struct in an option because it is often used as an optional field.
§Returns
An optional Content.
Sourcepub fn set_top_level_type(self, ty: &str) -> Self
pub fn set_top_level_type(self, ty: &str) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnwindSafe for Content
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<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>
Converts
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>
Converts
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