Skip to main content

ViewId

Struct ViewId 

Source
pub struct ViewId(/* private fields */);
Expand description

A small unique identifier, and handle, for an instance of a View.

Through this handle, you can access the associated view ViewState. You can also use this handle to access the children ViewId’s which allows you access to their states.

This type is not thread safe and can only be used from the main thread.

Implementations§

Source§

impl ViewId

Source

pub fn new() -> ViewId

Create a new unique Viewid.

Source

pub fn debug_name(&self) -> String

Get the chain of debug names that have been applied to this view.

This uses try_borrow on the view state so if the view state has already been borrowed when using this method, it won’t crash and it will just return an empty string.

Source

pub fn is_valid(&self) -> bool

Check if this ViewId is still valid (exists in VIEW_STORAGE).

A ViewId becomes invalid when it has been removed from the view tree. This is useful for filtering out stale ViewIds from collections.

Source

pub fn remove(&self)

Remove this view id and all of its children from the VIEW_STORAGE.

Note: For full cleanup including taffy nodes and cleanup listeners, use window_state.remove_view() or send an UpdateMessage::RemoveViews.

Source

pub fn taffy(&self) -> Rc<RefCell<TaffyTree<LayoutNodeCx>>>

Get access to the layout tree tree TODO: rename layout tree

Source

pub fn box_tree(&self) -> Rc<RefCell<BoxTree>>

Get access to the box tree

Source

pub fn new_taffy_node(&self) -> NodeId

Create a new taffy layout node

Source

pub fn set_taffy_style(&self, node: NodeId, style: Style)

Set the layout properties on a taffy node

Source

pub fn taffy_layout(&self, node: NodeId) -> Option<Layout>

Get the layout for a taffy node relative to it’s parent

Source

pub fn mark_view_layout_dirty(&self) -> Result<(), TaffyError>

Mark the taffy node associated with this view as dirty.

Source

pub fn taffy_node(&self) -> NodeId

Get the taffy node associated with this Id

Source

pub fn set_transform(&self, transform: Affine)

set the transform on a view that is applied after style transforms

Source

pub fn add_child(&self, child: Box<dyn View>)

Add a child View to this Id’s list of children

Source

pub fn append_children(&self, children: Vec<Box<dyn View>>)

Append multiple children to this Id’s list of children.

This is more efficient than calling add_child multiple times as it only borrows VIEW_STORAGE once.

Takes a Vec to ensure views are fully constructed before borrowing VIEW_STORAGE, avoiding potential borrow conflicts.

Source

pub fn set_children<const N: usize, V>(&self, children: [V; N])
where V: IntoView,

Set the children views of this Id See also Self::set_children_vec

Source

pub fn set_children_vec(&self, children: Vec<impl IntoView>)

Set the children views of this Id using a Vector See also Self::set_children and Self::set_children_iter

Source

pub fn set_children_iter(&self, children: impl Iterator<Item = Box<dyn View>>)

Set the children views of this Id using an iterator of boxed views.

This is the most efficient way to set children when you already have an iterator of Box<dyn View>, as it avoids intermediate allocations.

See also Self::set_children and Self::set_children_vec

Source

pub fn set_view(&self, view: Box<dyn View>)

Set the view that should be associated with this Id

Source

pub fn set_parent(&self, parent: ViewId)

Set the Id that should be used as the parent of this Id

Source

pub fn set_children_ids(&self, children: Vec<ViewId>)

Set the Ids that should be used as the children of this Id

Source

pub fn children(&self) -> Vec<ViewId>

Get the list of ViewIds that are associated with the children views of this ViewId

Source

pub fn with_children<R>(&self, children: impl FnMut(&[ViewId]) -> R) -> R

Get access to the list of ViewIds that are associated with the children views of this ViewId

Source

pub fn parent(&self) -> Option<ViewId>

Get the ViewId that has been set as this ViewId’s parent

Source

pub fn root(&self) -> ViewId

Get the root view of the window that the given view is in

Source

pub fn get_size(&self) -> Option<Size>

Get the size of this View

Source

pub fn parent_size(&self) -> Option<Size>

Get the Size of the parent View

Source

pub fn get_layout(&self) -> Option<Layout>

This gets the Taffy Layout and adjusts it to be relative to the parent View.

Source

pub fn get_element_id(&self) -> ElementId

Returns the [Visualid] associated with this view.

This id can be used with the box tree.

Source

pub fn get_visual_transform(&self) -> Affine

Returns the complete local-to-window coordinate transform.

This transform converts coordinates from this view’s local space to window coordinates. It combines:

  • The view’s position in the window
  • Any CSS transforms (scale, rotate)

To convert a local point to window coordinates: visual_transform * point To convert a window point to local coordinates: visual_transform.inverse() * point

This is the transform used by event dispatch to convert pointer coordinates.

Source

pub fn get_visual_rect(&self) -> Rect

Return the world-space axis-aligned bounding box for this view.

This is the loose AABB computed after applying local transforms and any active clips. It fully contains the transformed bounds but may not be tight, especially under rotation or rounded clips.

Source

pub fn get_visual_rect_no_clip(&self) -> Rect

Return the local bounds in world coordinate space

Source

pub fn get_visual_origin(&self) -> Point

Returns the view’s visual position (after applying all clips clips and css transforms) in window coordinates.

Source

pub fn get_layout_rect(&self) -> Rect

Returns the layout rect relative to the parent view.

The position is relative to the parent view’s origin. This is the raw layout as computed by Taffy, useful for measuring and positioning views within their parent’s coordinate space.

Source

pub fn get_content_rect(&self) -> Rect

Returns the content rect relative to the parent view.

The content rect excludes borders and padding, representing the area where content is positioned. The position is relative to the parent view’s origin.

Source

pub fn get_layout_rect_local(&self) -> Rect

Returns the layout rect in the view’s local coordinate space.

Source

pub fn get_content_rect_local(&self) -> Rect

Returns the content rect in the view’s local coordinate space.

The content rect excludes borders and padding, representing the area where child content should be positioned. This is in the view’s local coordinate space, with an offset that accounts for borders and padding.

Like layout_rect_local(), this is in the same coordinate space as events transformed via window_event_to_view().

Source

pub fn get_content_rect_relative( &self, child_node: NodeId, parent_node: NodeId, ) -> Option<Rect>

Returns the content rect of a child layout node, relative to the parent layout node’s origin.

This walks up the Taffy layout tree from child_node to parent_node, accumulating the positions to compute the final relative content rect.

Returns None if either node doesn’t exist or if child_node is not a descendant of parent_node.

Source

pub fn set_child_translation(&self, child_translation: Vec2) -> bool

Set a translation that will affect children.

If you have a view that visually affects how far children should scroll, set it here.

Source

pub fn get_child_translation(&self) -> Vec2

Get the translation that affects children

Source

pub fn set_box_tree_clip(&self, clip: Option<RoundedRect>)

set the clip rectange in local coordinates in the box tree

Source

pub fn is_hidden(&self) -> bool

Returns true if this view is hidden.

Source

pub fn pointer_events_none(&self) -> bool

if the view has pointer events none

Source

pub fn is_disabled(&self) -> bool

Returns true if the view is disabled

This is done by checking if the style for this view has Disabled set to true.

Source

pub fn is_selected(&self) -> bool

Returns true if the view is selected

This is done by checking if the parent has set this view as selected via parent_set_selected().

Source

pub fn can_focus(&self) -> bool

Check if this id can be focused.

This is done by checking if the style for this view has Focusable set to Focus::PointerAndProgramatic or Focus::KeyboardNavigable.

Source

pub fn request_all(&self)

Request that this the id view be styled, laid out and painted again. This will recursively request this for all parents.

Source

pub fn request_layout(&self)

Request that this view have it’s layout pass run

Source

pub fn request_mark_view_layout_dirty(&self)

Request that this view have it’s taffy node be marked dirty

Source

pub fn request_box_tree_update(&self)

Request that the box tree be updated from the layout tree (full walk) and committed. Use this after layout changes that affect the entire tree.

Source

pub fn request_box_tree_update_for_view(&self)

Request that this specific view’s box tree node be updated and committed. This is more efficient than a full tree update when only this view changed (e.g., after a transform or scroll offset change).

Source

pub fn request_box_tree_commit(&self)

Request that the box tree be committed without updating from layout. Use this when you’ve manually updated box tree nodes and just need to commit.

Source

pub fn window_id(&self) -> Option<WindowId>

Get the window id of the window containing this view, if there is one.

Source

pub fn request_paint(&self)

Request that this view have it’s paint pass run

Source

pub fn request_style(&self, reason: StyleReason)

request that this node be styled again

Source

pub fn request_view_style(&self)

👎Deprecated:

use id.request_style(StyleReasonSet::view_style()) directly instead

Use this when you want the view_style method from the View trait to be rerun.

Source

pub fn request_focus(&self)

Request that this view gain the window focus

Source

pub fn clear_focus(&self)

Clear the focus from this window

Source

pub fn update_context_menu( &self, menu: impl Fn() -> MenuBuilder<Menu> + 'static, )

Set the system context menu that should be shown when this view is right-clicked

Source

pub fn update_popout_menu(&self, menu: impl Fn() -> MenuBuilder<Menu> + 'static)

Set the system popout menu that should be shown when this view is clicked

Adds a primary-click context menu, which opens below the view.

Source

pub fn set_pointer_capture(&self, pointer_id: PointerId)

Set pointer capture for this view.

When a view has pointer capture for a pointer, all subsequent pointer events for that pointer are dispatched directly to this view, regardless of where the pointer moves. This is useful for:

  • Drag operations that should continue even when the pointer leaves the view
  • Sliders and scrollbars that need to track pointer movement globally
  • Any interaction that requires reliable pointer tracking

The capture will be applied on the next pointer event for this pointer ID. When capture is set:

  • GainedPointerCapture event is fired to this view
  • All subsequent pointer events for this pointer are routed here
  • When released, LostPointerCapture event is fired

Capture is automatically released on PointerUp for the captured pointer.

§Example
fn event_before_children(&mut self, cx: &mut EventCx, event: &Event) -> EventPropagation {
    if let Event::Pointer(PointerEvent::Down(e)) = event {
        if let Some(pointer_id) = e.pointer.pointer_id {
            self.id().set_pointer_capture(pointer_id);
        }
    }
    EventPropagation::Continue
}
Source

pub fn release_pointer_capture(&self, pointer_id: PointerId)

Release pointer capture from this view.

If this view has capture for the specified pointer, the capture will be released on the next pointer event. A LostPointerCapture event will be fired when the release takes effect.

Note: This only releases capture if this view currently has it. It’s safe to call even if this view doesn’t have capture.

Source

pub fn inspect(&self)

Send a message to the application to open the Inspector for this Window

Source

pub fn scroll_to(&self, rect: Option<Rect>)

Scrolls the view and all direct and indirect children to bring the view to be visible. The optional rectangle can be used to add an additional offset and intersection.

Source

pub fn update_state(&self, state: impl Any)

Send a state update to the update method of the associated View

Source

pub fn add_cleanup_listener(&self, action: Rc<dyn Fn()>)

Set a callback that should be run when the view is removed from the view tree

Source

pub fn get_combined_style(&self) -> Style

Get the resolved style for this view (base + selectors + classes).

This contains all style properties explicitly set on this view, including properties from applied classes and resolved selectors. It does NOT include inherited properties from ancestor views (like font_size, color, etc.).

§When to use

Use combined_style when you need to know what this specific view defines:

  • Checking if THIS view explicitly sets a property
  • Computing what should propagate to children (class definitions)
  • Building cache keys for style resolution
  • Style resolution logic that shouldn’t include inherited noise
§When NOT to use

Do not use for rendering or layout - use computed_style instead (accessed via prop extractors in style_pass), which includes inherited properties and represents what the user will actually see.

§Warning

The view styles do not store property transition states, only markers of which properties should be transitioned over time on change.

If you have a property that could be transitioned over time, make sure to use a prop extractor that is updated in a style method of the View to extract the property.

Source

pub fn add_class(&self, class: StyleClassRef)

Add a class to the list of style classes that are associated with this ViewId

Source

pub fn remove_class(&self, class: StyleClassRef)

Remove a class from the list of style classes that are associated with this ViewId

Source

pub fn set_cursor(&self, cursor: Option<CursorStyle>)

Set the cursor.

This will be overridden by any cursor set by view styles and will be overriden by cursors set on visual ids.

Source

pub fn disable_default_event(&self, event: EventListenerKey)

Disables the default view behavior for the specified event.

Children will still see the event, but the view event function will not be called nor the event listeners on the view

Source

pub fn remove_disable_default_event(&self, event: EventListenerKey)

Re-enables the default view behavior for a previously disabled event.

Source

pub fn window_visible(&self, visible: bool)

Alter the visibility of the current window the view represented by this ID is in.

Source

pub fn request_remove_views(&self, view_ids: Vec<ViewId>)

Request removal of views during the update phase.

This schedules the views to be removed with proper cleanup (cleanup listeners, taffy nodes, recursive children removal). Used by keyed_children for efficient keyed diffing.

Source

pub fn add_child_deferred( &self, child_fn: impl FnOnce() -> Box<dyn View> + 'static, )

Queue a child to be added during the next update cycle.

The child will be constructed when the message is processed. The scope is resolved at build time by looking up the parent’s context scope in the view hierarchy, enabling proper context propagation.

Source

pub fn add_children_deferred( &self, children_fn: impl FnOnce() -> Vec<Box<dyn View>> + 'static, )

Queue multiple children to be added during the next update cycle.

The children will be constructed when the message is processed. The scope is resolved at build time by looking up the parent’s context scope in the view hierarchy, enabling proper context propagation.

Source

pub fn setup_reactive_children_deferred(&self, setup: impl FnOnce() + 'static)

Queue a reactive children setup to run during the next update cycle.

The setup function will be called inside the view’s scope (resolved via find_scope()) when the message is processed. This enables lazy setup of reactive children (derived_children, derived_child, keyed_children) inside the correct scope for context access.

Source

pub fn update_state_deferred(&self, state: impl Any)

Send a state update that will be placed in deferred messages

Source

pub fn screen_layout(&self) -> Option<ScreenLayout>

Get a layout in screen-coordinates for this view, if possible.

Source

pub fn set_style_parent(&self, parent_id: ViewId)

Set the custom style parent to make it so that a view will pull it’s style context from a different parent. This is useful for overlays that are children of the window root but should pull their style cx from the creating view

Source

pub fn clear_style_parent(&self)

Clear the custom style parent

Source

pub fn set_children_scope(&self, scope: Scope)

Set the children scope for reactive children.

This stores the scope used by ParentView::derived_children so that when children are updated, the old scope can be properly disposed.

Source

pub fn take_children_scope(&self) -> Option<Scope>

Take and dispose the children scope, returning the old scope if it existed.

This is called when reactive children are updated to clean up the old scope.

Source

pub fn set_keyed_children(&self, children: Vec<(ViewId, Scope)>)

Set the keyed children state for reactive keyed children.

This stores the children and their scopes used by ParentView::keyed_children. Each child has its own scope that gets disposed when the child is removed.

Source

pub fn take_keyed_children(&self) -> Option<Vec<(ViewId, Scope)>>

Take the keyed children state, returning it if it existed.

This is called when keyed children are updated to apply diffs.

Source

pub fn set_scope(&self, scope: Scope)

Set the scope for this view.

Views that provide context to children (like Combobox, Dialog, etc.) should call this in their into_view() to store their scope. This scope is then used when processing deferred children so they have access to the context.

The scope hierarchy is kept in sync with the view hierarchy, so when a parent scope is disposed, all child scopes are also disposed.

Source

pub fn scope(&self) -> Option<Scope>

Get the scope for this view, if one was set.

Source

pub fn find_scope(&self) -> Option<Scope>

Find the nearest ancestor (including self) that has a scope.

This walks up the view tree to find the first view with a scope, which should be used when building deferred children.

Source

pub fn get_local_clip(&self) -> Option<RoundedRect>

get the local clip

Source

pub fn create_child_element_id(&self, z_index: i32) -> ElementId

Create a visual that is a child of the current view.

This will make it so that the visual id can receive events through the ViewID

Source

pub fn focus_nav_meta_for_element( &self, element_id: ElementId, ) -> Option<FocusNavMeta>

Read focus navigation metadata for a specific element owned by this view.

Source

pub fn set_focus_nav_meta_for_element( &self, element_id: ElementId, focus: FocusNavMeta, ) -> bool

Replace focus navigation metadata for a specific element.

Returns false when the element is stale and no metadata was written.

Source

pub fn set_focusable_for_element( &self, element_id: ElementId, focusable: bool, ) -> bool

Set whether an owned element can receive focus at all.

Clearing focusability also clears keyboard navigation.

Source

pub fn set_keyboard_navigable_for_element( &self, element_id: ElementId, keyboard_navigable: bool, ) -> bool

Set whether an owned element participates in keyboard traversal.

Enabling keyboard navigation also enables focusability.

Source

pub fn set_focus_group_for_element( &self, element_id: ElementId, group: Option<FocusSymbol>, ) -> bool

Set or clear group membership used by keyboard focus traversal policies.

Source

pub fn register_listener(&self, key: EventListenerKey)

Register this view to receive a specific event type.

Views must register for events they want to receive through the broadcast dispatch system, such as LayoutChanged or VisualChanged.

Source

pub fn remove_listener(&self, key: EventListenerKey)

Unregister this view from receiving a specific event type.

Source

pub fn route_event(&self, event: Event, route_kind: RouteKind)

Dispatch an event to this view using the specified routing strategy.

This queues an event to be dispatched during the next event processing cycle. The event will be routed according to the dispatch_kind parameter.

§Arguments
  • event - The event to dispatch
  • dispatch_kind - The routing strategy to use:
    • DispatchKind::Directed { target, phases } - Routes to target with specified phases
      • Use Phases::all() for full capture/bubble
      • Use Phases::TARGET for direct dispatch only
      • Use Phases::BUBBLE for bubble-only dispatch
    • DispatchKind::Spatial { point, phases } - Routes based on hit testing at a point
    • DispatchKind::Subtree { target, stop } - Routes to target and all descendants
    • DispatchKind::Focused { phases } - Routes to currently focused view
    • DispatchKind::Global { stop } - Broadcasts to all views
§Examples
// Dispatch a click directly to a specific view (target only, no propagation)
view_id.route_event(
    Event::Interaction(InteractionEvent::Click),
    RouteKind::Directed {
        target: view_id.get_element_id(),
        phases: Phases::TARGET
    }
);

// Dispatch a key event with full capture/bubble phases
Source

pub fn route_event_with_caused_by( &self, event: Event, route_kind: RouteKind, caused_by: Option<Event>, )

Dispatch an event with an optional causing event.

This is similar to dispatch_event, but allows you to specify an event that caused this dispatch. The causing event will be available in the EventCx::caused_by field.

§Arguments
  • event - The event to dispatch
  • dispatch_kind - The routing strategy to use
  • caused_by - An optional event that caused this dispatch (e.g., a PointerDown that caused a Click)
Source§

impl ViewId

Source

pub fn parent_set_selected(&self)

Set the selected state for child views during styling. This should be used by parent views to propagate selected state to their children. Only requests a style update if the state actually changes.

Source

pub fn parent_clear_selected(&self)

Clear the selected state for child views during styling. This should be used by parent views to clear selected state propagation to their children. Only requests a style update if the state actually changes.

Source

pub fn parent_set_disabled(&self)

Set the disabled state for child views during styling. This should be used by parent views to propagate disabled state to their children. Only requests a style update if the state actually changes.

Source

pub fn parent_clear_disabled(&self)

Clear the disabled state for child views during styling. This should be used by parent views to clear disabled state propagation to their children. Only requests a style update if the state actually changes.

Source

pub fn set_hidden(&self)

Hide this view from layout. Sets the parent set visibility state directly. Skips the normal transition animation logic. This should be used by parent views to set hidden state propagation to their children. Only requests a style update if the state actually changes.

Source

pub fn set_visible(&self)

Show this view in layout. Clears the parent set hidden state. This should be used by parent views to clear hidden state propagation to their children. Only requests a style update if the state actually changes.

Trait Implementations§

Source§

impl Clone for ViewId

Source§

fn clone(&self) -> ViewId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ViewId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ViewId

Source§

fn default() -> ViewId

Returns the “default value” for a type. Read more
Source§

impl From<KeyData> for ViewId

Source§

fn from(k: KeyData) -> ViewId

Converts to this type from the input type.
Source§

impl Hash for ViewId

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Key for ViewId

Source§

fn data(&self) -> KeyData

Gets the KeyData stored in this key. Read more
Source§

fn null() -> Self

Creates a new key that is always invalid and distinct from any non-null key. A null key can only be created through this method (or default initialization of keys made with new_key_type!, which calls this method). Read more
Source§

fn is_null(&self) -> bool

Checks if a key is null. There is only a single null key, that is a.is_null() && b.is_null() implies a == b. Read more
Source§

impl Ord for ViewId

Source§

fn cmp(&self, other: &ViewId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ViewId

Source§

fn eq(&self, other: &ViewId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ViewId

Source§

fn partial_cmp(&self, other: &ViewId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for ViewId

Source§

impl Eq for ViewId

Source§

impl StructuralPartialEq for ViewId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: 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.
§

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.
§

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.
§

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.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Brush for T
where T: Clone + PartialEq + Default + Debug,