pub struct Responsive {
pub id: Option<WidgetId>,
pub query: ResponsiveQuery,
pub cases: Vec<ResponsiveCase>,
pub fallback: Widget,
}Expand description
Selects a widget branch using declarative viewport or container breakpoints.
Fields§
§id: Option<WidgetId>Optional stable identity for diagnostics and retained child identity.
query: ResponsiveQueryWidth source used to evaluate the responsive cases.
cases: Vec<ResponsiveCase>Ordered cases; the first matching case wins.
fallback: WidgetChild rendered when no case matches.
Implementations§
Source§impl Responsive
impl Responsive
Sourcepub fn new(fallback: impl Into<Widget>) -> Self
pub fn new(fallback: impl Into<Widget>) -> Self
Creates a responsive switch with a required fallback branch.
Sourcepub fn id(self, id: WidgetId) -> Self
pub fn id(self, id: WidgetId) -> Self
Sets an explicit identity for deterministic inspection and diffing.
Sourcepub fn case(self, case: ResponsiveCase) -> Self
pub fn case(self, case: ResponsiveCase) -> Self
Appends an ordered responsive case.
Sourcepub fn query(self, query: ResponsiveQuery) -> Self
pub fn query(self, query: ResponsiveQuery) -> Self
Selects viewport or parent-container width evaluation.
Sourcepub fn container_query(self) -> Self
pub fn container_query(self) -> Self
Evaluates cases against the immediate parent constraints.
Trait Implementations§
Source§impl Clone for Responsive
impl Clone for Responsive
Source§fn clone(&self) -> Responsive
fn clone(&self) -> Responsive
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Responsive
impl Debug for Responsive
Source§impl<'de> Deserialize<'de> for Responsive
impl<'de> Deserialize<'de> for Responsive
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Responsive> for Widget
impl From<Responsive> for Widget
Source§fn from(w: Responsive) -> Self
fn from(w: Responsive) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Responsive
impl !UnwindSafe for Responsive
impl Freeze for Responsive
impl Send for Responsive
impl Sync for Responsive
impl Unpin for Responsive
impl UnsafeUnpin for Responsive
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.