Skip to main content

DatapackRegistrySet

Struct DatapackRegistrySet 

pub struct DatapackRegistrySet { /* private fields */ }
Expand description

The published entries of a world session at one generation.

Implementations§

§

impl DatapackRegistrySet

pub fn first(candidate: DatapackCandidate, session: u64) -> DatapackRegistrySet

Publishes candidate as a world session’s first set: generation 1.

pub fn reload( &self, candidate: DatapackCandidate, ) -> Result<DatapackRegistrySet, DatapackGenerationExhausted>

Publishes candidate after a successful reload of the same session: the next generation, even when the content is identical. A failed reload never gets here, so it takes no generation; the old set stays.

pub fn generation(&self) -> u64

The generation, from 1.

pub fn handle( &self, registry: &str, entry: &str, ) -> Result<DatapackHandle, DatapackReadError>

A handle to entry of registry in this set.

pub fn get( &self, handle: &DatapackHandle, ) -> Result<&DatapackEntry, DatapackReadError>

The entry a handle names, when the handle is of this session and generation and the entry is still there.

pub fn entries(&self, registry: &str) -> Result<Vec<&str>, DatapackReadError>

The entry ids of registry in this set, sorted.

§

impl DatapackRegistrySet

pub fn snapshot( &self, declarations: &[DatapackRegistryDeclaration], accepts: impl Fn(&DatapackRegistryDeclaration) -> bool, ) -> DatapackSnapshot

The snapshot of this set a peer receives: the registries declarations list as synchronized and accepts lets through (the game passes what the peer negotiated). Server-only registries are never in it.

pub fn snapshot_for( &self, declarations: &[DatapackRegistryDeclaration], offered: &[DatapackRegistryDeclaration], ) -> Result<DatapackSnapshot, DatapackNegotiationError>

The snapshot for a client that offered these registries (offer): a registry goes out when the client offered the same key with the same schema. A required registry the client did not offer so refuses it before any payload; an optional one it did not offer is left out, with nothing sent in its place.

pub fn received( snapshot: &DatapackSnapshot, candidate: DatapackCandidate, session: u64, ) -> DatapackRegistrySet

Publishes a snapshot’s candidate on a client at the generation the server sent. The session is this client’s own, so a handle from an earlier world fails as on a server.

§

impl DatapackRegistrySet

pub fn received_next( &self, snapshot: &DatapackSnapshot, candidate: DatapackCandidate, ) -> Option<DatapackRegistrySet>

Publishes a later snapshot’s candidate over this set, on a client: the same session, the server’s generation. None when the snapshot’s generation does not come after this one’s, so a snapshot out of order or sent twice changes nothing.

Trait Implementations§

§

impl Clone for DatapackRegistrySet

§

fn clone(&self) -> DatapackRegistrySet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
§

impl Debug for DatapackRegistrySet

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for DatapackRegistrySet

§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
§

impl StructuralPartialEq for DatapackRegistrySet

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