Struct Content
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§
§impl Content
impl Content
pub fn new(display_settings: DisplaySettings) -> Content
pub fn new(display_settings: DisplaySettings) -> Content
pub fn add_single<T>(self, value: &T) -> Contentwhere
T: ModuleDisplay + ?Sized,
pub fn add_single<T>(self, value: &T) -> Contentwhere
T: ModuleDisplay + ?Sized,
pub fn add_formatted<T>(self, value: &T) -> Contentwhere
T: Display,
pub fn add_formatted<T>(self, value: &T) -> Contentwhere
T: Display,
pub fn optional(self) -> Option<Content>
pub fn optional(self) -> Option<Content>
A convenience method to wrap the Attributes struct in an option because it is often used as an optional field.
§Returns
An optional Content.
pub fn set_top_level_type(self, ty: &str) -> Content
pub fn set_top_level_type(self, ty: &str) -> Content
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> 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