pub struct Separator {
pub color: Color,
pub thickness: f32,
pub pad_v: f32,
}Expand description
A horizontal divider line.
Renders a 1 px (default) line across the full width of its layout rect,
with vertical padding above and below. Use to break a column into
visual sections — between settings groups, list categories or content
blocks. The line takes the divider colour from the active theme by
default; override with Self::color for custom palettes.
// In view():
column()
.push( text( "General" ) )
.push( separator() )
.push( text( "Network" ) )
.into()Fields§
§color: ColorStroke colour. Defaults to the theme’s divider palette slot.
thickness: f32Line thickness in logical pixels.
pad_v: f32Vertical padding above and below the line, baked into
preferred_size so the divider visually centres in the row a
parent column allocates.
Implementations§
Source§impl Separator
impl Separator
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a separator with the theme’s default divider colour and 1 px thickness.
Sourcepub fn color(self, color: Color) -> Self
pub fn color(self, color: Color) -> Self
Override the stroke colour. Useful for emphasised dividers between destructive actions.
Sourcepub fn thickness(self, t: f32) -> Self
pub fn thickness(self, t: f32) -> Self
Override the line thickness. Defaults to 1 logical pixel.
Sourcepub fn preferred_size(&self, max_width: f32) -> (f32, f32)
pub fn preferred_size(&self, max_width: f32) -> (f32, f32)
Return the preferred (width, height). Width is max_width;
height is thickness + 2 × pad_v.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Separator
impl RefUnwindSafe for Separator
impl Send for Separator
impl Sync for Separator
impl Unpin for Separator
impl UnwindSafe for Separator
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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>
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