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: DisplaySettings
Display 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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