pub struct Element {
pub key: u64,
pub forms: Vec<SizePolicy>,
pub orientations: Vec<Orientation>,
pub pinned_orientation: Option<Orientation>,
pub pin: Option<Cell>,
}Expand description
One element of a container, in its logical order.
Fields§
§key: u64The caller’s stable key. Hysteresis finds an element’s previous choices by it, so keep it across layouts; keys should be unique.
forms: Vec<SizePolicy>The forms, largest first. Form 0 is the full form; the others are smaller forms, known to the engine only by index.
orientations: Vec<Orientation>The supported orientations, preferred first. Empty means horizontal.
pinned_orientation: Option<Orientation>An orientation chosen by the person, used instead of the preference when it is supported.
pin: Option<Cell>A position stored from the person’s layout, placed before the flow.
Implementations§
Source§impl Element
impl Element
Sourcepub fn new(key: u64, full: SizePolicy) -> Element
pub fn new(key: u64, full: SizePolicy) -> Element
A horizontal element with one form.
Sourcepub fn with_form(self, form: SizePolicy) -> Element
pub fn with_form(self, form: SizePolicy) -> Element
Adds a smaller form, after the existing ones.
Sourcepub fn with_orientations(self, orientations: &[Orientation]) -> Element
pub fn with_orientations(self, orientations: &[Orientation]) -> Element
Sets the supported orientations, preferred first.
Sourcepub fn with_pinned_orientation(self, orientation: Orientation) -> Element
pub fn with_pinned_orientation(self, orientation: Orientation) -> Element
Pins the orientation.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Element
impl<'de> Deserialize<'de> for Element
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
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
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