#[repr(u8)]pub enum OwnershipKind {
Owned = 0,
Strong = 1,
Weak = 2,
Ref = 3,
}Expand description
The four ownership kinds an interpreted reference can carry — re-exported from
the primitives, the crate-wide vocabulary.
A Foreign leaf, a struct field, and a variant payload all classify with it.
The ownership relationship a reference has with its target — the crate’s
four in-file reference kinds, the axis that selects teardown / deep-clone /
refcount behaviour for a field, a variant payload, or a cross-file
Foreign pointer.
This is the single vocabulary the whole crate branches on; the derive’s field
classifier, the RTTI interpreter, and the Foreign teardown helpers all express
the same four cases.
Variants§
Owned = 0
Owned (#[bstack_owned]): sole ownership. Torn down (freed) and
deep-cloned with its target.
Strong = 1
Strong (#[bstack_strong]): a shared, refcounted reference. Teardown
decrements the strong count (freeing at zero); clone increments it.
Weak = 2
Weak (#[bstack_weak]): a non-owning refcounted reference to a control
block. Teardown decrements the weak count; never keeps the target alive.
Ref = 3
Ref (#[bstack_ref]): a plain borrow — a bare offset with no ownership.
Teardown and clone leave the target untouched.
Implementations§
Source§impl OwnershipKind
impl OwnershipKind
Sourcepub const ALL: [OwnershipKind; 4]
pub const ALL: [OwnershipKind; 4]
All four kinds, in declaration order.
Sourcepub const fn as_u8(self) -> u8
pub const fn as_u8(self) -> u8
The kind’s stable 1-byte discriminant (Owned=0, Strong=1, Weak=2, Ref=3) —
the on-disk / wire encoding.