Skip to main content

CosmicNQuin

Struct CosmicNQuin 

Source
#[repr(C)]
pub struct CosmicNQuin { pub subject: u64, pub predicate: u64, pub object: u64, pub context: u64, pub metadata: u64, pub parity: u64, }
Expand description

A 48-byte cosmic NQuin built from OCS components.

This is a repr(C) flat struct matching the NQuin ABI in qualia-core-db. It can be transmuted to NQuin via bytemuck when crossing the crate boundary.

Fields§

§subject: u64§predicate: u64§object: u64§context: u64§metadata: u64§parity: u64

Implementations§

Source§

impl CosmicNQuin

Source

pub fn cosmic_pose( subject_did: &str, pose_iri: &str, realm_usri: &str, level: HierarchyLevel, sensitivity: u8, lamport_clock: u32, ) -> Self

Build a cosmic pose NQuin (OCS §14.2, OP_COSMIC_POSE).

Encodes: “entity subject_did has spacetime pose pose_iri in realm realm_usri at level level”.

Source

pub fn realm_transit( subject_did: &str, target_realm_usri: &str, source_realm_usri: &str, level: HierarchyLevel, sensitivity: u8, lamport_clock: u32, ) -> Self

Build a realm transit NQuin (OCS §14.2, OP_REALM_TRANSIT).

Source

pub fn observer_fiber( observer_did: &str, perceived_frame_usi: &str, realm_usri: &str, level: HierarchyLevel, sensitivity: u8, lamport_clock: u32, ) -> Self

Build an observer fiber NQuin (OCS §14.2, OP_OBSERVER_FIBER).

Source

pub fn micro_pose( subject_did: &str, pose_iri: &str, realm_usri: &str, level: HierarchyLevel, sensitivity: u8, lamport_clock: u32, ) -> Self

Build a micro-pose NQuin (OCS §14.2, OP_MICRO_POSE).

Source

pub fn element_collapse( narrative_entity_iri: &str, physical_anchor_iri: &str, realm_usri: &str, level: HierarchyLevel, sensitivity: u8, lamport_clock: u32, ) -> Self

Build an element collapse NQuin (OCS §14.2, OP_ELEMENT_COLLAPSE).

Source

pub fn opcode(&self) -> u8

Extract the opcode from the predicate field.

Source

pub fn subject_hash(&self) -> u64

Extract the subject DID hash (without MSB).

Source

pub fn object_hash(&self) -> u64

Extract the object IRI hash (without MSB).

Source

pub fn sensitivity(&self) -> u8

Extract the sensitivity class from the context field.

Source

pub fn realm_hash(&self) -> u64

Extract the realm hash from the context field (56-bit).

Source

pub fn routing_lane(&self) -> u8

Extract the routing lane from the metadata field.

Source

pub fn lamport_clock(&self) -> u32

Extract the Lamport logical clock from the metadata field (29 bits).

Source

pub fn realm_class_index(&self) -> u8

Extract the realm class index from the metadata lower 32 bits.

Source

pub fn hierarchy_level(&self) -> Option<HierarchyLevel>

Extract the hierarchy level from the metadata.

Source

pub fn nesting_depth(&self) -> u8

Extract the nesting depth from the metadata.

Source

pub fn verify_parity(&self) -> bool

Verify the parity field (XOR fold check).

Source

pub fn to_bytes(&self) -> [u8; 48]

Encode to 48 bytes.

Source

pub fn from_bytes(bytes: &[u8; 48]) -> Self

Decode from 48 bytes.

Source

pub const fn size_bytes() -> usize

Size in bytes (always 48 for NQuin ABI).

Trait Implementations§

Source§

impl Clone for CosmicNQuin

Source§

fn clone(&self) -> Self

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 Copy for CosmicNQuin

Source§

impl Debug for CosmicNQuin

Source§

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

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

impl Eq for CosmicNQuin

Source§

impl Hash for CosmicNQuin

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CosmicNQuin

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Pod for CosmicNQuin

Source§

impl StructuralPartialEq for CosmicNQuin

Source§

impl Zeroable for CosmicNQuin

§

fn zeroed() -> Self

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
§

impl<T> AnyBitPattern for T
where T: Pod,

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> NoUninit for T
where T: Pod,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

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

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,