mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 06:28:11 +08:00
Rename ElementEdge to ElementInput
This commit is contained in:
@@ -216,7 +216,7 @@ unsafe fn element_only<El: Clone>(rec: Rec<'_>, _reads: &[Option<usize>]) -> El
|
|||||||
unsafe { read_element::<El>(rec) }
|
unsafe { read_element::<El>(rec) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ElementEdge<'a, 'e, Out, N> {
|
pub struct ElementInput<'a, 'e, Out, N> {
|
||||||
node: &'a N,
|
node: &'a N,
|
||||||
layout: &'a Layout,
|
layout: &'a Layout,
|
||||||
reads: &'a [Option<usize>],
|
reads: &'a [Option<usize>],
|
||||||
@@ -224,7 +224,7 @@ pub struct ElementEdge<'a, 'e, Out, N> {
|
|||||||
frames: &'a Frames<'e>,
|
frames: &'a Frames<'e>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'e, El: Clone, N> ElementEdge<'a, 'e, El, N> {
|
impl<'a, 'e, El: Clone, N> ElementInput<'a, 'e, El, N> {
|
||||||
pub fn new(node: &'a N, layout: &'a Layout, frames: &'a Frames<'e>) -> Self {
|
pub fn new(node: &'a N, layout: &'a Layout, frames: &'a Frames<'e>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
node,
|
node,
|
||||||
@@ -236,7 +236,7 @@ impl<'a, 'e, El: Clone, N> ElementEdge<'a, 'e, El, N> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'e, Out, N> ElementEdge<'a, 'e, Out, N> {
|
impl<'a, 'e, Out, N> ElementInput<'a, 'e, Out, N> {
|
||||||
/// `read` must be sound against the layout the offsets in `reads` were
|
/// `read` must be sound against the layout the offsets in `reads` were
|
||||||
/// resolved from; the macro proves both at wiring.
|
/// resolved from; the macro proves both at wiring.
|
||||||
pub fn with_reads(node: &'a N, layout: &'a Layout, reads: &'a [Option<usize>], read: unsafe fn(Rec<'_>, &[Option<usize>]) -> Out, frames: &'a Frames<'e>) -> Self {
|
pub fn with_reads(node: &'a N, layout: &'a Layout, reads: &'a [Option<usize>], read: unsafe fn(Rec<'_>, &[Option<usize>]) -> Out, frames: &'a Frames<'e>) -> Self {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ mod testkit;
|
|||||||
|
|
||||||
pub use access::{Rec, RecordValue, apply_plan, borrow_element, erase_static, read_at, read_element, token_only, write_element, write_element_sized, write_field};
|
pub use access::{Rec, RecordValue, apply_plan, borrow_element, erase_static, read_at, read_element, token_only, write_element, write_element_sized, write_field};
|
||||||
pub use frames::{FrameArena, FrameScope, Frames};
|
pub use frames::{FrameArena, FrameScope, Frames};
|
||||||
pub use input::{DerivedLazyInput, DerivedRecordInput, ElementEdge, ElementLazyInput, LevelStatus, RecordExtract, RecordInput, RecordLazyInput, fill_frames, materialize_batch, materialize_level};
|
pub use input::{DerivedLazyInput, DerivedRecordInput, ElementInput, ElementLazyInput, LevelStatus, RecordExtract, RecordInput, RecordLazyInput, fill_frames, materialize_batch, materialize_level};
|
||||||
pub use layout::{
|
pub use layout::{
|
||||||
ElToken, ElementSpec, ElementWrite, ElementWritePick, ElementWritePickHashed, ElementWritePickPlain, FieldDesc, FieldOffset, FieldWrite, InputReads, Layout, LayoutMeta, RecordLayout, copy_plan,
|
ElToken, ElementSpec, ElementWrite, ElementWritePick, ElementWritePickHashed, ElementWritePickPlain, FieldDesc, FieldOffset, FieldWrite, InputReads, Layout, LayoutMeta, RecordLayout, copy_plan,
|
||||||
element_dims, element_parked, element_write, element_write_hashed, empty_layout,
|
element_dims, element_parked, element_write, element_write_hashed, empty_layout,
|
||||||
|
|||||||
@@ -1135,7 +1135,7 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
|
|||||||
(LazyBinding::OpaqueRecord, _) => quote!(#pat: &#core_types::record::RecordInput<'_, #frames_lifetime, #source_generic>),
|
(LazyBinding::OpaqueRecord, _) => quote!(#pat: &#core_types::record::RecordInput<'_, #frames_lifetime, #source_generic>),
|
||||||
(LazyBinding::Element, true) => {
|
(LazyBinding::Element, true) => {
|
||||||
let out = lazy_read_out(field, output_type);
|
let out = lazy_read_out(field, output_type);
|
||||||
quote!(#pat: &#core_types::record::ElementEdge<'_, #frames_lifetime, #out, #source_generic>)
|
quote!(#pat: &#core_types::record::ElementInput<'_, #frames_lifetime, #out, #source_generic>)
|
||||||
}
|
}
|
||||||
(LazyBinding::Element, false) => {
|
(LazyBinding::Element, false) => {
|
||||||
let out = lazy_read_out(field, output_type);
|
let out = lazy_read_out(field, output_type);
|
||||||
@@ -1457,13 +1457,13 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
|
|||||||
let slot = format_ident!("__in_{index}");
|
let slot = format_ident!("__in_{index}");
|
||||||
match field.attribute_reads.is_empty() {
|
match field.attribute_reads.is_empty() {
|
||||||
true => quote! {
|
true => quote! {
|
||||||
let #name = #core_types::record::ElementEdge::<#output_type, _>::new(&self.#name, &self.#slot, &__lazy_frames);
|
let #name = #core_types::record::ElementInput::<#output_type, _>::new(&self.#name, &self.#slot, &__lazy_frames);
|
||||||
},
|
},
|
||||||
false => {
|
false => {
|
||||||
let arr = format_ident!("__reads_{index}");
|
let arr = format_ident!("__reads_{index}");
|
||||||
let read_fn = format_ident!("__{}_read_{}", fn_name, index);
|
let read_fn = format_ident!("__{}_read_{}", fn_name, index);
|
||||||
quote! {
|
quote! {
|
||||||
let #name = #core_types::record::ElementEdge::with_reads(&self.#name, &self.#slot, &self.#arr, self::#read_fn, &__lazy_frames);
|
let #name = #core_types::record::ElementInput::with_reads(&self.#name, &self.#slot, &self.#arr, self::#read_fn, &__lazy_frames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user