Enum bones_asset::SchemaRefAccess
pub enum SchemaRefAccess<'a> {
Struct(StructRefAccess<'a>),
Vec(SchemaVecAccess<'a>),
Enum(EnumRefAccess<'a>),
Map(SchemaMapAccess<'a>),
Primitive(PrimitiveRef<'a>),
}
Expand description
Helper for accessing the inner data of a schema ref at runtime.
Variants§
Struct(StructRefAccess<'a>)
Access a struct.
Vec(SchemaVecAccess<'a>)
Access a vec.
Enum(EnumRefAccess<'a>)
Access an enum.
Map(SchemaMapAccess<'a>)
Access a map.
Primitive(PrimitiveRef<'a>)
Access a struct.
Implementations§
§impl<'ptr> SchemaRefAccess<'ptr>
impl<'ptr> SchemaRefAccess<'ptr>
pub fn new(value: SchemaRef<'_>) -> SchemaRefAccess<'_>
pub fn new(value: SchemaRef<'_>) -> SchemaRefAccess<'_>
Create a new SchemaRefAccess
for the given SchemaRef
.
This will create a new independent SchemaRefAccess
that may be used even after
the original SchemaRef
is dropped ( but not beyond the safe lifetime of the
original schema ref ).
pub fn new_borrowed<'borrow>(
value: &'borrow SchemaRef<'_>
) -> SchemaRefAccess<'borrow>
pub fn new_borrowed<'borrow>( value: &'borrow SchemaRef<'_> ) -> SchemaRefAccess<'borrow>
Create a new SchemaRefAccess
for the given SchemaRef
that borrows the original
SchemaRef
.
This is subtly different from SchemaRefAccess::new()
because it requires that it hold
a borrow to the original schema ref it was created from. This is specifically useful becuse
it lets you create a SchemaRefAccess
from a refeence to a schema ref, which is required
when accessing a schema ref that is behind an atomic resource borrow, for example.
pub fn field<'a, I>(self, field_idx: I) -> Option<SchemaRefAccess<'ptr>>where
I: Into<FieldIdx<'a>>,
pub fn field<'a, I>(self, field_idx: I) -> Option<SchemaRefAccess<'ptr>>where I: Into<FieldIdx<'a>>,
Get field with the given index.
pub fn field_path<'a, I>(self, path: I) -> Option<SchemaRefAccess<'ptr>>where
I: IntoIterator<Item = FieldIdx<'a>>,
pub fn field_path<'a, I>(self, path: I) -> Option<SchemaRefAccess<'ptr>>where I: IntoIterator<Item = FieldIdx<'a>>,
Get the field pointed to by the given path.
pub fn into_schema_ref(self) -> SchemaRef<'ptr>
pub fn into_schema_ref(self) -> SchemaRef<'ptr>
Borrow this SchemaRefMutAccess
as a SchemaRefAccess
.
Trait Implementations§
§impl<'a> Clone for SchemaRefAccess<'a>
impl<'a> Clone for SchemaRefAccess<'a>
§fn clone(&self) -> SchemaRefAccess<'a>
fn clone(&self) -> SchemaRefAccess<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more