pub struct RowPatch { /* private fields */ }Expand description
Owned, ergonomic table-generic word patch builder that encodes directly into flat u32 words
and implements FlatResource.
Implementations§
Source§impl RowPatch
impl RowPatch
pub const fn new() -> Self
pub fn is_empty(&self) -> bool
pub fn table_count(&self) -> usize
pub fn has_table<T: NvTable>(&self) -> bool
pub fn clear(&mut self)
Sourcepub fn set<T: NvTable, V: ScalarField>(
&mut self,
prop: Prop<T, V>,
value: V,
) -> &mut Self
pub fn set<T: NvTable, V: ScalarField>( &mut self, prop: Prop<T, V>, value: V, ) -> &mut Self
Records a typed scalar, narrow-optional, wide-optional, or 64-bit property override for
table T, coalescing packed sibling fields cleanly and setting word-0’s explicit bit on
#[nv_table(inherited)] tables.
Sourcepub fn with<T: NvTable, V: ScalarField>(
self,
prop: Prop<T, V>,
value: V,
) -> Self
pub fn with<T: NvTable, V: ScalarField>( self, prop: Prop<T, V>, value: V, ) -> Self
Fluent by-value counterpart to Self::set.
Sourcepub fn set_res_id<T: NvTable, R: FlatResource>(
&mut self,
prop: ResProp<T, R>,
id: ResourceId,
) -> &mut Self
pub fn set_res_id<T: NvTable, R: FlatResource>( &mut self, prop: ResProp<T, R>, id: ResourceId, ) -> &mut Self
Records a ResourceId override for a Res<R> field of table T (marking it as a
refcounted child resource edge when id != ResourceId::NONE).
Sourcepub fn with_res_id<T: NvTable, R: FlatResource>(
self,
prop: ResProp<T, R>,
id: ResourceId,
) -> Self
pub fn with_res_id<T: NvTable, R: FlatResource>( self, prop: ResProp<T, R>, id: ResourceId, ) -> Self
Fluent by-value counterpart to Self::set_res_id.
Sourcepub fn merge(&mut self, other: &Self)
pub fn merge(&mut self, other: &Self)
Merges all operations from other on top of self (last-writer-wins cascade).
Sourcepub fn merge_view(&mut self, other: RowPatchView<'_>)
pub fn merge_view(&mut self, other: RowPatchView<'_>)
Merges all operations from a zero-copy RowPatchView on top of self.
Sourcepub fn apply_table<T: NvTable>(&self, out: &mut [Word]) -> bool
pub fn apply_table<T: NvTable>(&self, out: &mut [Word]) -> bool
Applies every op targeting table T onto out (skipping string words and mismatched
resource/scalar flags). Returns true if T was present in this patch.
Sourcepub fn apply_table_with_mask<T: NvTable>(
&self,
out: &mut [Word],
written_masks: &mut [u32],
) -> bool
pub fn apply_table_with_mask<T: NvTable>( &self, out: &mut [Word], written_masks: &mut [u32], ) -> bool
Applies ops targeting table T onto out and ORs each op’s clear_mask into
written_masks[w] so backends (e.g. Web CSS) know exactly which packed bits were patched.
Sourcepub fn get_prop<T: NvTable, V: ScalarField>(
&self,
prop: Prop<T, V>,
) -> Option<V>
pub fn get_prop<T: NvTable, V: ScalarField>( &self, prop: Prop<T, V>, ) -> Option<V>
Reads prop if all bits/words belonging to prop were set in this patch.
Sourcepub fn get_res_id<T: NvTable, R: FlatResource>(
&self,
prop: ResProp<T, R>,
) -> Option<ResourceId>
pub fn get_res_id<T: NvTable, R: FlatResource>( &self, prop: ResProp<T, R>, ) -> Option<ResourceId>
Reads the patched ResourceId for prop, if set in this patch.
Sourcepub fn visit_resources(&self, visit: impl FnMut(ResourceId))
pub fn visit_resources(&self, visit: impl FnMut(ResourceId))
Visits every non-none ResourceId referenced by this owned patch.
Sourcepub fn from_view(view: RowPatchView<'_>) -> Self
pub fn from_view(view: RowPatchView<'_>) -> Self
Decodes a RowPatchView back into an owned RowPatch.
Trait Implementations§
impl Eq for RowPatch
Source§impl FlatResource for RowPatch
impl FlatResource for RowPatch
Source§type View<'a> = RowPatchView<'a>
type View<'a> = RowPatchView<'a>
u32 slab words.Source§fn write_words(&self, out: &mut Vec<u32>) -> bool
fn write_words(&self, out: &mut Vec<u32>) -> bool
self into flat u32 words in out (returning false if an encode-side limit
is exceeded).Source§fn validate(words: &[u32]) -> bool
fn validate(words: &[u32]) -> bool
words.Source§fn view<'a>(words: ValidatedWords<'a, Self>) -> Self::View<'a>
fn view<'a>(words: ValidatedWords<'a, Self>) -> Self::View<'a>
words.Source§fn child_resources(words: &[u32], visit: &mut dyn FnMut(ResourceId))
fn child_resources(words: &[u32], visit: &mut dyn FnMut(ResourceId))
ResourceId embedded in words so ResourceStore can
retain/release transitive dependencies and topologically order NV02 DefineResources.