Skip to main content

FragmentTable

Struct FragmentTable 

Source
pub struct FragmentTable { /* private fields */ }
Expand description

Every fragment an app declares, keyed by Fragment::key.

Ordered rather than hashed: the artifact encodes the table field by field, so a stable order is what makes two builds of the same sources produce the same bytes.

Implementations§

Source§

impl FragmentTable

Source

pub fn new() -> Self

Empty table.

Source

pub fn insert(&mut self, fragment: Fragment) -> Result<(), FragmentError>

Add fragment under its own key.

A key already holding the same declaration absorbs the new origins and keeps one entry, which is what an include reached from two paths produces. A key holding a different declaration is an error: keys are content-addressed, so two different bodies under one key means the content that produced the key was not the content being stored.

Source

pub fn get(&self, key: &str) -> Option<&Fragment>

Look a fragment up by key.

Source

pub fn iter(&self) -> impl Iterator<Item = (&String, &Fragment)>

Every fragment, in key order.

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Fragment>

Every fragment, in key order, for a pass that rewrites bodies.

Source

pub fn by_component(&self, name: &str) -> Option<(&Fragment, bool)>

The fragment a candela component name reaches, with whether the baked body is what calling the function would have returned.

A name no component carries yields None, which the caller reports as an unknown tag.

Source

pub fn component(&self, name: &str) -> Option<&FragmentComponent>

The candela component a use site naming name reaches.

A function that has to run is reached by name alone, so this answers without reference to the block it happens to be attached to.

Source

pub fn names(&self) -> BTreeSet<String>

Every name a use site may write: each fragment key, plus each candela component name.

Source

pub fn len(&self) -> usize

How many fragments are declared.

Source

pub fn is_empty(&self) -> bool

Whether the table declares nothing.

Source

pub fn merge(&mut self, other: FragmentTable) -> Result<(), FragmentError>

Fold other into this table, applying the same collision rule per key. Used to combine what markup declared with what the scripts declared.

Trait Implementations§

Source§

impl Clone for FragmentTable

Source§

fn clone(&self) -> FragmentTable

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

impl Debug for FragmentTable

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for FragmentTable

Source§

fn default() -> FragmentTable

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FragmentTable

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FragmentTable

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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.

§

impl<T> FromTemplate for T
where T: Clone + Default + Unpin,

§

type Template = T

The [Template] for this type.
§

impl<T> FromWorld for T
where T: Default,

§

fn from_world(_world: &mut World) -> T

Creates Self using default().

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
§

impl<T> Template for T
where T: Clone + Default + Unpin,

§

type Output = T

The type of value produced by this [Template].
§

fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>

Uses this template and the given entity context to produce a [Template::Output].
§

fn clone_template(&self) -> T

Clones this template. See Clone.
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,