Skip to main content

BlockData

Struct BlockData 

Source
pub struct BlockData<T>(/* private fields */);
Expand description

A value kept for each block, by dimension and place (its chunk’s store, as <x>_<y>_<z>.<key> within the chunk): removed as it’s broken or another is put there.

Implementations§

Source§

impl<T: Schema + Default + Send + 'static> BlockData<T>

Source

pub const fn new(key: &'static str) -> Self

Source

pub const fn synced(key: &'static str) -> Self

Kept, and sent to the clients that see its owner as it changes (their reads the server’s value; their writes their own until it sends the next).

Source

pub fn with<R>( &'static self, owner: (&str, BlockPos), read: impl FnOnce(&T) -> R, ) -> R

What read makes of the owner’s value.

Source

pub fn with_mut<R>( &'static self, owner: (&str, BlockPos), change: impl FnOnce(&mut T) -> R, ) -> R

The owner’s value changed by change (saved with the world).

Auto Trait Implementations§

§

impl<T> !Freeze for BlockData<T>

§

impl<T> RefUnwindSafe for BlockData<T>
where Owned<(String, [i32; 3]), T>: RefUnwindSafe,

§

impl<T> Send for BlockData<T>
where Owned<(String, [i32; 3]), T>: Send,

§

impl<T> Sync for BlockData<T>
where Owned<(String, [i32; 3]), T>: Sync,

§

impl<T> Unpin for BlockData<T>
where Owned<(String, [i32; 3]), T>: Unpin,

§

impl<T> UnsafeUnpin for BlockData<T>
where Owned<(String, [i32; 3]), T>: UnsafeUnpin,

§

impl<T> UnwindSafe for BlockData<T>
where Owned<(String, [i32; 3]), T>: UnwindSafe,

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

impl<T> Arg<T> for T

Source§

fn arg(self) -> T

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.