Struct DatapackRegistrySet
pub struct DatapackRegistrySet { /* private fields */ }Expand description
The published entries of a world session at one generation.
Implementations§
§impl DatapackRegistrySet
impl DatapackRegistrySet
pub fn first(candidate: DatapackCandidate, session: u64) -> 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>
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
pub fn generation(&self) -> u64
The generation, from 1.
pub fn handle(
&self,
registry: &str,
entry: &str,
) -> Result<DatapackHandle, DatapackReadError>
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>
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.
§impl DatapackRegistrySet
impl DatapackRegistrySet
pub fn snapshot(
&self,
declarations: &[DatapackRegistryDeclaration],
accepts: impl Fn(&DatapackRegistryDeclaration) -> bool,
) -> DatapackSnapshot
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>
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
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
impl DatapackRegistrySet
pub fn received_next(
&self,
snapshot: &DatapackSnapshot,
candidate: DatapackCandidate,
) -> Option<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
impl Clone for DatapackRegistrySet
§fn clone(&self) -> DatapackRegistrySet
fn clone(&self) -> DatapackRegistrySet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more