Struct naia_shared::Property
source · pub struct Property<T: Serde> { /* private fields */ }
Expand description
A Property of an Component/Message, that contains data which must be tracked for updates
Implementations§
source§impl<T: Serde> Property<T>
impl<T: Serde> Property<T>
sourcepub fn host_owned(value: T, mutator_index: u8) -> Self
pub fn host_owned(value: T, mutator_index: u8) -> Self
Create a new host-owned Property
sourcepub fn new_read(reader: &mut BitReader<'_>) -> Result<Self, SerdeErr>
pub fn new_read(reader: &mut BitReader<'_>) -> Result<Self, SerdeErr>
Given a cursor into incoming packet data, initializes the Property with the synced value
sourcepub fn set_mutator(&mut self, mutator: &PropertyMutator)
pub fn set_mutator(&mut self, mutator: &PropertyMutator)
Set an PropertyMutator to track changes to the Property
sourcepub fn write(&self, writer: &mut dyn BitWrite)
pub fn write(&self, writer: &mut dyn BitWrite)
Writes contained value into outgoing byte stream
sourcepub fn read_write(
reader: &mut BitReader<'_>,
writer: &mut BitWriter
) -> Result<(), SerdeErr>
pub fn read_write( reader: &mut BitReader<'_>, writer: &mut BitWriter ) -> Result<(), SerdeErr>
Reads from a stream and immediately writes to a stream Used to buffer updates for later
sourcepub fn read(&mut self, reader: &mut BitReader<'_>) -> Result<(), SerdeErr>
pub fn read(&mut self, reader: &mut BitReader<'_>) -> Result<(), SerdeErr>
Given a cursor into incoming packet data, updates the Property with the synced value
sourcepub fn mirror(&mut self, other: &Self)
pub fn mirror(&mut self, other: &Self)
Set value to the value of another Property, queues for update if value changes
sourcepub fn remote_publish(&mut self, mutator_index: u8, mutator: &PropertyMutator)
pub fn remote_publish(&mut self, mutator_index: u8, mutator: &PropertyMutator)
Migrate Remote Property to Public version
sourcepub fn remote_unpublish(&mut self)
pub fn remote_unpublish(&mut self)
Migrate Remote Property to Private version
sourcepub fn enable_delegation(
&mut self,
accessor: &EntityAuthAccessor,
mutator_opt: Option<(u8, &PropertyMutator)>
)
pub fn enable_delegation( &mut self, accessor: &EntityAuthAccessor, mutator_opt: Option<(u8, &PropertyMutator)> )
Migrate Property to Delegated version
sourcepub fn disable_delegation(&mut self)
pub fn disable_delegation(&mut self)
Migrate Delegated Property to Host-Owned (Public) version
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Property<T>
impl<T> Send for Property<T>where
T: Send,
impl<T> Sync for Property<T>where
T: Sync,
impl<T> Unpin for Property<T>where
T: Unpin,
impl<T> !UnwindSafe for Property<T>
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