pub struct SpatialPage {
pub header: SpatialPageHeader,
pub nodes: Vec<NodeRec>,
pub properties: HashMap<u64, HashMap<String, String>>,
pub edges: Vec<PageLocalEdge>,
}Expand description
A spatial page: header + nodes + properties + edges, packed into a contiguous byte slice.
Fields§
§header: SpatialPageHeader§nodes: Vec<NodeRec>§properties: HashMap<u64, HashMap<String, String>>node_id -> properties for nodes in this page.
edges: Vec<PageLocalEdge>Edges where source node is in this page.
Implementations§
Source§impl SpatialPage
impl SpatialPage
Sourcepub fn new(morton_prefix: u64, morton_shift: u8) -> Self
pub fn new(morton_prefix: u64, morton_shift: u8) -> Self
Create an empty page with given Morton prefix and shift.
Sourcepub fn pack(&self) -> Result<Vec<u8>>
pub fn pack(&self) -> Result<Vec<u8>>
Pack this page into a byte vector. Zero-allocation layout: one vec, direct slices.
Sourcepub fn unpack(data: &[u8]) -> Result<Self>
pub fn unpack(data: &[u8]) -> Result<Self>
Unpack a single spatial page from a byte slice. Zero-copy: nodes and edges are slices.
Sourcepub fn find_node_by_id(&self, id: u64) -> Option<usize>
pub fn find_node_by_id(&self, id: u64) -> Option<usize>
Find a node by its global ID using binary search (nodes are Morton-sorted). O(log n) within the page.
Sourcepub fn get_properties(&self, node_id: u64) -> Option<&HashMap<String, String>>
pub fn get_properties(&self, node_id: u64) -> Option<&HashMap<String, String>>
Get properties for a node in this page.
Sourcepub fn get_edges_for_node(&self, node_id: u64) -> Vec<&PageLocalEdge>
pub fn get_edges_for_node(&self, node_id: u64) -> Vec<&PageLocalEdge>
Get edges where source is a given node in this page.
Trait Implementations§
Source§impl Clone for SpatialPage
impl Clone for SpatialPage
Source§fn clone(&self) -> SpatialPage
fn clone(&self) -> SpatialPage
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 moreAuto Trait Implementations§
impl Freeze for SpatialPage
impl RefUnwindSafe for SpatialPage
impl Send for SpatialPage
impl Sync for SpatialPage
impl Unpin for SpatialPage
impl UnsafeUnpin for SpatialPage
impl UnwindSafe for SpatialPage
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