pub struct PhantomCluster {
pub id: String,
pub anchor: ContentAnchor,
pub label: String,
pub scope: PhantomScope,
pub author: Option<Collaborator>,
pub created: Option<DateTime<Utc>>,
pub metadata: HashMap<String, Value>,
pub phantoms: Vec<Phantom>,
}Expand description
A cluster of phantoms attached to a content anchor.
Fields§
§id: StringUnique identifier for this cluster.
anchor: ContentAnchorContent anchor where this cluster attaches.
label: StringDisplay label for the cluster.
scope: PhantomScopeVisibility scope for this cluster.
Author who created this cluster.
created: Option<DateTime<Utc>>When the cluster was created.
metadata: HashMap<String, Value>Custom metadata for the cluster.
phantoms: Vec<Phantom>Phantoms within this cluster.
Implementations§
Source§impl PhantomCluster
impl PhantomCluster
Sourcepub fn new(
id: impl Into<String>,
anchor: ContentAnchor,
label: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, anchor: ContentAnchor, label: impl Into<String>, ) -> Self
Create a new phantom cluster.
Sourcepub fn with_scope(self, scope: PhantomScope) -> Self
pub fn with_scope(self, scope: PhantomScope) -> Self
Set the visibility scope.
Set the author.
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Add metadata.
Sourcepub fn add_phantom(&mut self, phantom: Phantom)
pub fn add_phantom(&mut self, phantom: Phantom)
Add a phantom to this cluster.
Sourcepub fn with_phantom(self, phantom: Phantom) -> Self
pub fn with_phantom(self, phantom: Phantom) -> Self
Add a phantom and return self for chaining.
Sourcepub fn find_phantom(&self, id: &str) -> Option<&Phantom>
pub fn find_phantom(&self, id: &str) -> Option<&Phantom>
Find a phantom by ID.
Sourcepub fn find_phantom_mut(&mut self, id: &str) -> Option<&mut Phantom>
pub fn find_phantom_mut(&mut self, id: &str) -> Option<&mut Phantom>
Find a phantom by ID mutably.
Sourcepub fn validate_connections(&self, state: DocumentState) -> Vec<String>
pub fn validate_connections(&self, state: DocumentState) -> Vec<String>
Validate connections within this cluster.
Checks:
- All connection targets exist within this cluster
- No circular references that would cause infinite loops
Returns errors in Frozen/Published states, warnings in Draft/Review.
Trait Implementations§
Source§impl Clone for PhantomCluster
impl Clone for PhantomCluster
Source§fn clone(&self) -> PhantomCluster
fn clone(&self) -> PhantomCluster
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PhantomCluster
impl Debug for PhantomCluster
Source§impl<'de> Deserialize<'de> for PhantomCluster
impl<'de> Deserialize<'de> for PhantomCluster
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PhantomCluster
impl PartialEq for PhantomCluster
Source§impl Serialize for PhantomCluster
impl Serialize for PhantomCluster
impl StructuralPartialEq for PhantomCluster
Auto Trait Implementations§
impl Freeze for PhantomCluster
impl RefUnwindSafe for PhantomCluster
impl Send for PhantomCluster
impl Sync for PhantomCluster
impl Unpin for PhantomCluster
impl UnsafeUnpin for PhantomCluster
impl UnwindSafe for PhantomCluster
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