pub struct GraphFragment {
pub version: u32,
pub nodes: BTreeMap<NodeId, Node>,
pub ports: BTreeMap<PortId, Port>,
pub edges: BTreeMap<EdgeId, Edge>,
pub imports: BTreeMap<GraphId, GraphImport>,
pub groups: BTreeMap<GroupId, Group>,
pub sticky_notes: BTreeMap<StickyNoteId, StickyNote>,
pub symbols: BTreeMap<SymbolId, Symbol>,
pub bindings: BTreeMap<BindingId, Binding>,
}Expand description
A deterministic, serializable graph fragment.
Fields§
§version: u32§nodes: BTreeMap<NodeId, Node>§ports: BTreeMap<PortId, Port>§edges: BTreeMap<EdgeId, Edge>§imports: BTreeMap<GraphId, GraphImport>§groups: BTreeMap<GroupId, Group>§sticky_notes: BTreeMap<StickyNoteId, StickyNote>§symbols: BTreeMap<SymbolId, Symbol>§bindings: BTreeMap<BindingId, Binding>Implementations§
Source§impl GraphFragment
impl GraphFragment
Sourcepub fn to_clipboard_text(&self) -> Result<String, Error>
pub fn to_clipboard_text(&self) -> Result<String, Error>
Serializes this fragment to a clipboard-friendly text payload.
Sourcepub fn from_clipboard_text(text: &str) -> Result<Self, Error>
pub fn from_clipboard_text(text: &str) -> Result<Self, Error>
Parses a fragment from clipboard text.
Accepts both:
- the canonical
jellyflow.fragment.v1header format, - raw JSON (useful for debugging and external tooling).
Source§impl GraphFragment
impl GraphFragment
Sourcepub fn from_nodes(
graph: &Graph,
nodes: impl IntoIterator<Item = NodeId>,
) -> Self
pub fn from_nodes( graph: &Graph, nodes: impl IntoIterator<Item = NodeId>, ) -> Self
Builds a fragment from a set of nodes, capturing:
- the selected nodes,
- their ports,
- edges that connect between selected nodes.
Groups/notes are not inferred; callers may add them explicitly.
Symbols are inferred for built-in symbol-ref nodes (core::SYMBOL_REF_NODE_KIND) so
copy/paste can remain self-contained for the “blackboard variables” contract.
Sourcepub fn from_selection(
graph: &Graph,
selected_nodes: impl IntoIterator<Item = NodeId>,
selected_groups: impl IntoIterator<Item = GroupId>,
) -> Self
pub fn from_selection( graph: &Graph, selected_nodes: impl IntoIterator<Item = NodeId>, selected_groups: impl IntoIterator<Item = GroupId>, ) -> Self
Builds a fragment from a selection of nodes and groups.
Captures:
- selected groups,
- selected nodes,
- nodes inside selected groups,
- ports for all captured nodes,
- edges that connect between captured nodes.
Nodes are detached from their parent group unless that group is included in the fragment.
Source§impl GraphFragment
impl GraphFragment
Sourcepub fn to_paste_transaction(
&self,
remapper: &IdRemapper,
tuning: PasteTuning,
) -> GraphTransaction
pub fn to_paste_transaction( &self, remapper: &IdRemapper, tuning: PasteTuning, ) -> GraphTransaction
Remaps IDs and produces a transaction that inserts the fragment into a graph.
The resulting transaction is deterministic for a given seed.
Trait Implementations§
Source§impl Clone for GraphFragment
impl Clone for GraphFragment
Source§fn clone(&self) -> GraphFragment
fn clone(&self) -> GraphFragment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GraphFragment
impl Debug for GraphFragment
Source§impl Default for GraphFragment
impl Default for GraphFragment
Source§impl<'de> Deserialize<'de> for GraphFragment
impl<'de> Deserialize<'de> for GraphFragment
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
Auto Trait Implementations§
impl Freeze for GraphFragment
impl RefUnwindSafe for GraphFragment
impl Send for GraphFragment
impl Sync for GraphFragment
impl Unpin for GraphFragment
impl UnsafeUnpin for GraphFragment
impl UnwindSafe for GraphFragment
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