MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / with_scope

Method with_scope

atomic-core/src/pristine/traits/view.rs:619–628  ·  view source on GitHub ↗

Create a new view with explicit scope and parent. # Example ``` use atomic_core::pristine::{ViewState, ViewScope}; // Create a shared "dev" view parented on "main" (id=1) let dev = ViewState::with_scope(2, "dev".to_string(), ViewScope::Shared, Some(1)); assert!(dev.kind.is_shared()); assert_eq!(dev.parent, Some(1)); // Create a draft "feature" view parented on "dev" (id=2) let feature = ViewSt

(id: u64, name: String, kind: ViewScope, parent: Option<u64>)

Source from the content-addressed store, hash-verified

617 /// assert_eq!(feature.parent, Some(2));
618 /// ```
619 pub fn with_scope(id: u64, name: String, kind: ViewScope, parent: Option<u64>) -> Self {
620 Self {
621 id,
622 name,
623 state: Merkle::ZERO,
624 change_count: 0,
625 kind,
626 parent,
627 }
628 }
629
630 /// Check if the view has any changes.
631 pub fn is_empty(&self) -> bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected