pub struct ViewExistential { /* private fields */ }Expand description
A heap-allocated any View existential container.
This is the native alternative to AnyView — constructed entirely from Rust using the Swift runtime’s value witness tables and metadata.
Implementations§
Source§impl ViewExistential
impl ViewExistential
Sourcepub unsafe fn new(
value: *const c_void,
value_size: usize,
metadata: *const c_void,
view_wt: *const c_void,
) -> Self
pub unsafe fn new( value: *const c_void, value_size: usize, metadata: *const c_void, view_wt: *const c_void, ) -> Self
Create a new existential from a concrete view value.
§Safety
valuemust point to a valid instance of the type described bymetadatametadatamust be a valid Swift type metadata pointerview_wtmust be a valid View protocol witness table for the type
Sourcepub unsafe fn from_zero_size(
metadata: *const c_void,
view_wt: *const c_void,
) -> Self
pub unsafe fn from_zero_size( metadata: *const c_void, view_wt: *const c_void, ) -> Self
Create from a zero-size type (EmptyView, Divider).
§Safety
metadata must describe a type whose size is zero, and view_wt must be
its View conformance. A type with a size has a value to point at, and
this passes none.
Sourcepub fn witness_table(&self) -> *const c_void
pub fn witness_table(&self) -> *const c_void
Get the View witness table pointer.
Trait Implementations§
Source§impl Clone for ViewExistential
impl Clone for ViewExistential
Source§impl Drop for ViewExistential
impl Drop for ViewExistential
impl Send for ViewExistential
Auto Trait Implementations§
impl !Sync for ViewExistential
impl Freeze for ViewExistential
impl RefUnwindSafe for ViewExistential
impl Unpin for ViewExistential
impl UnsafeUnpin for ViewExistential
impl UnwindSafe for ViewExistential
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