pub enum ExtractionMetadata {
Target {
type_id: TypeId,
offset: usize,
identifier: &'static str,
},
Nested {
type_id: TypeId,
offset: usize,
nested: &'static [ExtractionMetadata],
identifier: &'static str,
},
}Expand description
Metadata describing how to extract types from an entity structure.
Variants§
Implementations§
Source§impl ExtractionMetadata
impl ExtractionMetadata
Sourcepub const fn new<T: Extractable>(offset: usize) -> Self
pub const fn new<T: Extractable>(offset: usize) -> Self
Create metadata for a direct target type.
Sourcepub const fn new_nested<T: Extractable>(
offset: usize,
nested: &'static [ExtractionMetadata],
) -> Self
pub const fn new_nested<T: Extractable>( offset: usize, nested: &'static [ExtractionMetadata], ) -> Self
Create metadata for a nested extractable type.
Sourcepub const fn is_has<List: Extractable, Target: Extractable>() -> bool
pub const fn is_has<List: Extractable, Target: Extractable>() -> bool
Compile-time check whether List contains Target in its extraction metadata.
This function is designed to be called at the beginning of functions that may panic.
Since const panics don’t support #[track_caller], it’s best to place this check
at the start of public API functions for better error reporting.
§Implementation Note
Uses string-based identifier comparison instead of TypeId::eq() because:
TypeId::eq()is not yet stable in const context (as of Rust 1.83)type_name()is also not const-stable- String comparison with
IDENTIFIER(module_path + struct_name) provides the same uniqueness guarantee while being const-evaluable
pub const fn has_val(&self, identifier: &str) -> bool
Auto Trait Implementations§
impl Freeze for ExtractionMetadata
impl RefUnwindSafe for ExtractionMetadata
impl Send for ExtractionMetadata
impl Sync for ExtractionMetadata
impl Unpin for ExtractionMetadata
impl UnwindSafe for ExtractionMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more