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>)
| 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 { |
nothing calls this directly
no outgoing calls
no test coverage detected