Skip to main content

Mirror

Trait Mirror 

Source
pub trait Mirror: Sized + 'static {
    type View<'a>: From<Row<'a, Self>>;
    type Writer<'w>: From<RowWriter<'w, Self>>;

    const NAME: &'static str;
    const OWNER: Option<&'static str>;
    const SPACE: &'static str;
    const ALL: u64;
    const FAMILY: bool = false;
    const CLOCK: Clock = Clock::Server;

    // Required methods
    fn fields() -> Vec<FieldSpec>;
    fn read(row: &Row<'_, Self>) -> Self;
    fn write(&self, row: &mut RowWriter<'_, Self>);

    // Provided methods
    fn address() -> String { ... }
    fn spec() -> MirrorSpec { ... }
    fn declare(fields: u64, rate: Rate) -> Result<Mirrored<Self>, Diagnostic> { ... }
    fn declare_scoped<S: Schema>(
        scope: &S,
        fields: u64,
        rate: Rate,
    ) -> Result<Mirrored<Self>, Diagnostic> { ... }
    fn declare_in<S: Schema>(
        member: &str,
        scope: Option<&S>,
        fields: u64,
        rate: Rate,
    ) -> Result<Mirrored<Self>, Diagnostic> { ... }
}
Expand description

A mirror’s row type (#[yog_mirror] implements it).

Required Associated Constants§

Source

const NAME: &'static str

Its name’s last part: yog:mirror/<mod>/<NAME>.

Source

const OWNER: Option<&'static str>

The mod providing it; None: this one.

Source

const SPACE: &'static str

Its key space (yog_ids::key_space::*).

Source

const ALL: u64

Every field’s bit.

Provided Associated Constants§

Source

const FAMILY: bool = false

Its key space is a family (a member each parameter, declare_in).

Source

const CLOCK: Clock = Clock::Server

Whose ticks it’s written after (the server’s, unless it’s a client’s view).

Required Associated Types§

Source

type View<'a>: From<Row<'a, Self>>

A row read.

Source

type Writer<'w>: From<RowWriter<'w, Self>>

A row written.

Required Methods§

Source

fn fields() -> Vec<FieldSpec>

Its fields, in order.

Source

fn read(row: &Row<'_, Self>) -> Self

The whole row (a field not asked for reads as its default).

Source

fn write(&self, row: &mut RowWriter<'_, Self>)

Every due field of row set from self.

Provided Methods§

Source

fn address() -> String

Its address.

Source

fn spec() -> MirrorSpec

Source

fn declare(fields: u64, rate: Rate) -> Result<Mirrored<Self>, Diagnostic>

Asks for fields (its bit consts or-ed) at rate.

Source

fn declare_scoped<S: Schema>( scope: &S, fields: u64, rate: Rate, ) -> Result<Mirrored<Self>, Diagnostic>

Mirror::declare covering scope (its scope type: a BlockScope…) — a mirror that isn’t a family’s.

Source

fn declare_in<S: Schema>( member: &str, scope: Option<&S>, fields: u64, rate: Rate, ) -> Result<Mirrored<Self>, Diagnostic>

Mirror::declare in member member of its family (a dimension: minecraft:overworld), covering scope (its scope type: a BlockScope…).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Mirror for Blocks

Source§

const NAME: &'static str = "blocks"

Source§

const ALL: u64 = 1u64

Source§

const OWNER: Option<&'static str> = None

Source§

const SPACE: &'static str

Source§

const CLOCK: Clock

Source§

type View<'a> = BlocksView<'a>

Source§

type Writer<'w> = BlocksWriter<'w>

Source§

impl Mirror for ClientBlocks

Source§

const NAME: &'static str = "client_blocks"

Source§

const ALL: u64 = 7u64

Source§

const OWNER: Option<&'static str> = None

Source§

const SPACE: &'static str

Source§

const CLOCK: Clock

Source§

type View<'a> = ClientBlocksView<'a>

Source§

type Writer<'w> = ClientBlocksWriter<'w>

Source§

impl Mirror for ClientEntities

Source§

const NAME: &'static str = "client_entities"

Source§

const ALL: u64 = 511u64

Source§

const OWNER: Option<&'static str> = None

Source§

const SPACE: &'static str

Source§

const CLOCK: Clock

Source§

type View<'a> = ClientEntitiesView<'a>

Source§

type Writer<'w> = ClientEntitiesWriter<'w>

Source§

impl Mirror for Entities

Source§

const NAME: &'static str = "entities"

Source§

const ALL: u64 = 127u64

Source§

const OWNER: Option<&'static str> = None

Source§

const SPACE: &'static str

Source§

const CLOCK: Clock

Source§

type View<'a> = EntitiesView<'a>

Source§

type Writer<'w> = EntitiesWriter<'w>

Source§

impl Mirror for Players

Source§

const NAME: &'static str = "players"

Source§

const ALL: u64 = 1u64

Source§

const OWNER: Option<&'static str> = None

Source§

const SPACE: &'static str

Source§

const CLOCK: Clock

Source§

type View<'a> = PlayersView<'a>

Source§

type Writer<'w> = PlayersWriter<'w>