pub struct LayoutContext {
pub measured_node_sizes: BTreeMap<NodeId, CanvasSize>,
pub pinned_nodes: BTreeSet<NodeId>,
pub node_origin: Option<(f32, f32)>,
}Expand description
Runtime or host-owned context available to layout engines.
Fields§
§measured_node_sizes: BTreeMap<NodeId, CanvasSize>Runtime-reported node sizes. Graph node sizes and request-local measured sizes win.
pinned_nodes: BTreeSet<NodeId>Nodes that engines should treat as fixed when they support pinning.
node_origin: Option<(f32, f32)>Runtime fallback node origin, usually resolved from interaction state.
Implementations§
Source§impl LayoutContext
impl LayoutContext
Sourcepub fn new() -> LayoutContext
pub fn new() -> LayoutContext
Creates an empty layout context.
Sourcepub fn with_measured_node_sizes(
self,
sizes: impl IntoIterator<Item = (NodeId, CanvasSize)>,
) -> LayoutContext
pub fn with_measured_node_sizes( self, sizes: impl IntoIterator<Item = (NodeId, CanvasSize)>, ) -> LayoutContext
Adds runtime-reported node sizes.
Sourcepub fn with_pinned_nodes(
self,
nodes: impl IntoIterator<Item = NodeId>,
) -> LayoutContext
pub fn with_pinned_nodes( self, nodes: impl IntoIterator<Item = NodeId>, ) -> LayoutContext
Adds nodes that engines should keep fixed when possible.
Sourcepub fn with_node_origin(self, node_origin: (f32, f32)) -> LayoutContext
pub fn with_node_origin(self, node_origin: (f32, f32)) -> LayoutContext
Sets the runtime fallback node origin.
Trait Implementations§
Source§impl Clone for LayoutContext
impl Clone for LayoutContext
Source§fn clone(&self) -> LayoutContext
fn clone(&self) -> LayoutContext
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 LayoutContext
impl Debug for LayoutContext
Source§impl Default for LayoutContext
impl Default for LayoutContext
Source§fn default() -> LayoutContext
fn default() -> LayoutContext
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LayoutContext
impl<'de> Deserialize<'de> for LayoutContext
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for LayoutContext
impl PartialEq for LayoutContext
Source§fn eq(&self, other: &LayoutContext) -> bool
fn eq(&self, other: &LayoutContext) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for LayoutContext
impl Serialize for LayoutContext
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for LayoutContext
Auto Trait Implementations§
impl Freeze for LayoutContext
impl RefUnwindSafe for LayoutContext
impl Send for LayoutContext
impl Sync for LayoutContext
impl Unpin for LayoutContext
impl UnsafeUnpin for LayoutContext
impl UnwindSafe for LayoutContext
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