pub struct GrafeoDB { /* private fields */ }Expand description
Your handle to a Grafeo database.
Start here. Create one with new_in_memory() for
quick experiments, or open() for persistent storage.
Then grab a session() to start querying.
§Examples
use grafeo_engine::GrafeoDB;
// Quick in-memory database
let db = GrafeoDB::new_in_memory();
// Add some data
db.create_node(&["Person"]);
// Query it
let session = db.session();
let result = session.execute("MATCH (p:Person) RETURN p")?;Implementations§
Source§impl GrafeoDB
impl GrafeoDB
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in the database.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Returns the number of edges in the database.
Sourcepub fn label_count(&self) -> usize
pub fn label_count(&self) -> usize
Returns the number of distinct labels in the database.
Sourcepub fn property_key_count(&self) -> usize
pub fn property_key_count(&self) -> usize
Returns the number of distinct property keys in the database.
Sourcepub fn edge_type_count(&self) -> usize
pub fn edge_type_count(&self) -> usize
Returns the number of distinct edge types in the database.
Sourcepub fn is_persistent(&self) -> bool
pub fn is_persistent(&self) -> bool
Returns true if this database is backed by a file (persistent).
In-memory databases return false.
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
Returns the database file path, if persistent.
In-memory databases return None.
Sourcepub fn info(&self) -> DatabaseInfo
pub fn info(&self) -> DatabaseInfo
Returns high-level database information.
Includes node/edge counts, persistence status, and mode (LPG/RDF).
Sourcepub fn detailed_stats(&self) -> DatabaseStats
pub fn detailed_stats(&self) -> DatabaseStats
Returns detailed database statistics.
Includes counts, memory usage, and index information.
Sourcepub fn schema(&self) -> SchemaInfo
pub fn schema(&self) -> SchemaInfo
Returns schema information (labels, edge types, property keys).
For LPG mode, returns label and edge type information. For RDF mode, returns predicate and named graph information.
Sourcepub fn list_indexes(&self) -> Vec<IndexInfo>
pub fn list_indexes(&self) -> Vec<IndexInfo>
Returns detailed information about all indexes.
Sourcepub fn validate(&self) -> ValidationResult
pub fn validate(&self) -> ValidationResult
Validates database integrity.
Checks for:
- Dangling edge references (edges pointing to non-existent nodes)
- Internal index consistency
Returns a list of errors and warnings. Empty errors = valid.
Sourcepub fn wal_status(&self) -> WalStatus
pub fn wal_status(&self) -> WalStatus
Returns WAL (Write-Ahead Log) status.
Returns None if WAL is not enabled.
Sourcepub fn wal_checkpoint(&self) -> Result<()>
pub fn wal_checkpoint(&self) -> Result<()>
Forces a WAL checkpoint.
Flushes all pending WAL records to the main storage.
§Errors
Returns an error if the checkpoint fails.
Source§impl GrafeoDB
impl GrafeoDB
Sourcepub fn create_node(&self, labels: &[&str]) -> NodeId
pub fn create_node(&self, labels: &[&str]) -> NodeId
Creates a node with the given labels and returns its ID.
Labels categorize nodes - think of them like tags. A node can have
multiple labels (e.g., ["Person", "Employee"]).
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
let alix = db.create_node(&["Person"]);
let company = db.create_node(&["Company", "Startup"]);Sourcepub fn create_node_with_props(
&self,
labels: &[&str],
properties: impl IntoIterator<Item = (impl Into<PropertyKey>, impl Into<Value>)>,
) -> NodeId
pub fn create_node_with_props( &self, labels: &[&str], properties: impl IntoIterator<Item = (impl Into<PropertyKey>, impl Into<Value>)>, ) -> NodeId
Creates a new node with labels and properties.
If WAL is enabled, the operation is logged for durability.
Sourcepub fn get_node_at_epoch(&self, id: NodeId, epoch: EpochId) -> Option<Node>
pub fn get_node_at_epoch(&self, id: NodeId, epoch: EpochId) -> Option<Node>
Gets a node as it existed at a specific epoch.
Uses pure epoch-based visibility (not transaction-aware), so the node
is visible if and only if created_epoch <= epoch and it was not
deleted at or before epoch.
Sourcepub fn get_edge_at_epoch(&self, id: EdgeId, epoch: EpochId) -> Option<Edge>
pub fn get_edge_at_epoch(&self, id: EdgeId, epoch: EpochId) -> Option<Edge>
Gets an edge as it existed at a specific epoch.
Uses pure epoch-based visibility (not transaction-aware).
Sourcepub fn get_node_history(
&self,
id: NodeId,
) -> Vec<(EpochId, Option<EpochId>, Node)>
pub fn get_node_history( &self, id: NodeId, ) -> Vec<(EpochId, Option<EpochId>, Node)>
Returns all versions of a node with their creation/deletion epochs.
Properties and labels reflect the current state (not versioned per-epoch).
Sourcepub fn get_edge_history(
&self,
id: EdgeId,
) -> Vec<(EpochId, Option<EpochId>, Edge)>
pub fn get_edge_history( &self, id: EdgeId, ) -> Vec<(EpochId, Option<EpochId>, Edge)>
Returns all versions of an edge with their creation/deletion epochs.
Properties reflect the current state (not versioned per-epoch).
Sourcepub fn current_epoch(&self) -> EpochId
pub fn current_epoch(&self) -> EpochId
Returns the current epoch of the database.
Sourcepub fn delete_node(&self, id: NodeId) -> bool
pub fn delete_node(&self, id: NodeId) -> bool
Deletes a node and all its edges.
If WAL is enabled, the operation is logged for durability.
Sourcepub fn set_node_property(&self, id: NodeId, key: &str, value: Value)
pub fn set_node_property(&self, id: NodeId, key: &str, value: Value)
Sets a property on a node.
If WAL is enabled, the operation is logged for durability.
Sourcepub fn add_node_label(&self, id: NodeId, label: &str) -> bool
pub fn add_node_label(&self, id: NodeId, label: &str) -> bool
Adds a label to an existing node.
Returns true if the label was added, false if the node doesn’t exist
or already has the label.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
let alix = db.create_node(&["Person"]);
// Promote Alix to Employee
let added = db.add_node_label(alix, "Employee");
assert!(added);Sourcepub fn remove_node_label(&self, id: NodeId, label: &str) -> bool
pub fn remove_node_label(&self, id: NodeId, label: &str) -> bool
Removes a label from a node.
Returns true if the label was removed, false if the node doesn’t exist
or doesn’t have the label.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
let alix = db.create_node(&["Person", "Employee"]);
// Remove Employee status
let removed = db.remove_node_label(alix, "Employee");
assert!(removed);Sourcepub fn get_node_labels(&self, id: NodeId) -> Option<Vec<String>>
pub fn get_node_labels(&self, id: NodeId) -> Option<Vec<String>>
Gets all labels for a node.
Returns None if the node doesn’t exist.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
let alix = db.create_node(&["Person", "Employee"]);
let labels = db.get_node_labels(alix).unwrap();
assert!(labels.contains(&"Person".to_string()));
assert!(labels.contains(&"Employee".to_string()));Sourcepub fn create_edge(&self, src: NodeId, dst: NodeId, edge_type: &str) -> EdgeId
pub fn create_edge(&self, src: NodeId, dst: NodeId, edge_type: &str) -> EdgeId
Creates an edge (relationship) between two nodes.
Edges connect nodes and have a type that describes the relationship.
They’re directed - the order of src and dst matters.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
let alix = db.create_node(&["Person"]);
let gus = db.create_node(&["Person"]);
// Alix knows Gus (directed: Alix -> Gus)
let edge = db.create_edge(alix, gus, "KNOWS");Sourcepub fn create_edge_with_props(
&self,
src: NodeId,
dst: NodeId,
edge_type: &str,
properties: impl IntoIterator<Item = (impl Into<PropertyKey>, impl Into<Value>)>,
) -> EdgeId
pub fn create_edge_with_props( &self, src: NodeId, dst: NodeId, edge_type: &str, properties: impl IntoIterator<Item = (impl Into<PropertyKey>, impl Into<Value>)>, ) -> EdgeId
Creates a new edge with properties.
If WAL is enabled, the operation is logged for durability.
Sourcepub fn delete_edge(&self, id: EdgeId) -> bool
pub fn delete_edge(&self, id: EdgeId) -> bool
Deletes an edge.
If WAL is enabled, the operation is logged for durability.
Sourcepub fn set_edge_property(&self, id: EdgeId, key: &str, value: Value)
pub fn set_edge_property(&self, id: EdgeId, key: &str, value: Value)
Sets a property on an edge.
If WAL is enabled, the operation is logged for durability.
Sourcepub fn remove_node_property(&self, id: NodeId, key: &str) -> bool
pub fn remove_node_property(&self, id: NodeId, key: &str) -> bool
Removes a property from a node.
Returns true if the property existed and was removed, false otherwise.
Sourcepub fn remove_edge_property(&self, id: EdgeId, key: &str) -> bool
pub fn remove_edge_property(&self, id: EdgeId, key: &str) -> bool
Removes a property from an edge.
Returns true if the property existed and was removed, false otherwise.
Sourcepub fn batch_create_nodes(
&self,
label: &str,
property: &str,
vectors: Vec<Vec<f32>>,
) -> Vec<NodeId>
pub fn batch_create_nodes( &self, label: &str, property: &str, vectors: Vec<Vec<f32>>, ) -> Vec<NodeId>
Creates multiple nodes in bulk, each with a single vector property.
Much faster than individual create_node_with_props calls because it
acquires internal locks once and loops in Rust rather than crossing
the FFI boundary per vector.
§Arguments
label- Label applied to all created nodesproperty- Property name for the vector datavectors- Vector data for each node
§Returns
Vector of created NodeIds in the same order as the input vectors.
Source§impl GrafeoDB
impl GrafeoDB
Sourcepub fn create_property_index(&self, property: &str)
pub fn create_property_index(&self, property: &str)
Creates an index on a node property for O(1) lookups by value.
After creating an index, calls to Self::find_nodes_by_property will be
O(1) instead of O(n) for this property. The index is automatically
maintained when properties are set or removed.
§Example
// Create an index on the 'email' property
db.create_property_index("email");
// Now lookups by email are O(1)
let nodes = db.find_nodes_by_property("email", &Value::from("alix@example.com"));Sourcepub fn drop_property_index(&self, property: &str) -> bool
pub fn drop_property_index(&self, property: &str) -> bool
Drops an index on a node property.
Returns true if the index existed and was removed.
Sourcepub fn has_property_index(&self, property: &str) -> bool
pub fn has_property_index(&self, property: &str) -> bool
Returns true if the property has an index.
Sourcepub fn find_nodes_by_property(
&self,
property: &str,
value: &Value,
) -> Vec<NodeId>
pub fn find_nodes_by_property( &self, property: &str, value: &Value, ) -> Vec<NodeId>
Finds all nodes that have a specific property value.
If the property is indexed, this is O(1). Otherwise, it scans all nodes
which is O(n). Use Self::create_property_index for frequently queried properties.
§Example
// Create index for fast lookups (optional but recommended)
db.create_property_index("city");
// Find all nodes where city = "NYC"
let nyc_nodes = db.find_nodes_by_property("city", &Value::from("NYC"));Sourcepub fn create_vector_index(
&self,
label: &str,
property: &str,
dimensions: Option<usize>,
metric: Option<&str>,
m: Option<usize>,
ef_construction: Option<usize>,
) -> Result<()>
pub fn create_vector_index( &self, label: &str, property: &str, dimensions: Option<usize>, metric: Option<&str>, m: Option<usize>, ef_construction: Option<usize>, ) -> Result<()>
Creates a vector similarity index on a node property.
This enables efficient approximate nearest-neighbor search on vector properties. Currently validates the index parameters and scans existing nodes to verify the property contains vectors of the expected dimensions.
§Arguments
label- Node label to index (e.g.,"Doc")property- Property containing vector embeddings (e.g.,"embedding")dimensions- Expected vector dimensions (inferred from data ifNone)metric- Distance metric:"cosine"(default),"euclidean","dot_product","manhattan"m- HNSW links per node (default: 16). Higher = better recall, more memory.ef_construction- Construction beam width (default: 128). Higher = better index quality, slower build.
§Errors
Returns an error if the metric is invalid, no vectors are found, or dimensions don’t match.
Source§impl GrafeoDB
impl GrafeoDB
Sourcepub fn save(&self, path: impl AsRef<Path>) -> Result<()>
pub fn save(&self, path: impl AsRef<Path>) -> Result<()>
Saves the database to a file path.
- If in-memory: creates a new persistent database at path
- If file-backed: creates a copy at the new path
The original database remains unchanged.
§Errors
Returns an error if the save operation fails.
Requires the wal feature for persistence support.
Sourcepub fn to_memory(&self) -> Result<Self>
pub fn to_memory(&self) -> Result<Self>
Creates an in-memory copy of this database.
Returns a new database that is completely independent. Useful for:
- Testing modifications without affecting the original
- Faster operations when persistence isn’t needed
§Errors
Returns an error if the copy operation fails.
Sourcepub fn open_in_memory(path: impl AsRef<Path>) -> Result<Self>
pub fn open_in_memory(path: impl AsRef<Path>) -> Result<Self>
Opens a database file and loads it entirely into memory.
The returned database has no connection to the original file. Changes will NOT be written back to the file.
§Errors
Returns an error if the file can’t be opened or loaded.
Sourcepub fn export_snapshot(&self) -> Result<Vec<u8>>
pub fn export_snapshot(&self) -> Result<Vec<u8>>
Exports the entire database to a binary snapshot.
The returned bytes can be stored (e.g. in IndexedDB) and later
restored with import_snapshot().
§Errors
Returns an error if serialization fails.
Sourcepub fn import_snapshot(data: &[u8]) -> Result<Self>
pub fn import_snapshot(data: &[u8]) -> Result<Self>
Creates a new in-memory database from a binary snapshot.
The data must have been produced by export_snapshot().
All edge references are validated before any data is inserted: every edge’s source and destination must reference a node present in the snapshot, and duplicate node/edge IDs are rejected. If validation fails, no database is created.
§Errors
Returns an error if the snapshot is invalid, contains dangling edge references, has duplicate IDs, or deserialization fails.
Sourcepub fn restore_snapshot(&self, data: &[u8]) -> Result<()>
pub fn restore_snapshot(&self, data: &[u8]) -> Result<()>
Replaces the current database contents with data from a binary snapshot.
The data must have been produced by export_snapshot().
All validation (duplicate IDs, dangling edge references) is performed before any data is modified. If validation fails, the current database is left unchanged. If validation passes, the store is cleared and rebuilt from the snapshot atomically (from the perspective of subsequent queries).
§Errors
Returns an error if the snapshot is invalid, contains dangling edge references, has duplicate IDs, or deserialization fails.
Sourcepub fn iter_nodes(&self) -> impl Iterator<Item = Node> + '_
pub fn iter_nodes(&self) -> impl Iterator<Item = Node> + '_
Returns an iterator over all nodes in the database.
Useful for dump/export operations.
Sourcepub fn iter_edges(&self) -> impl Iterator<Item = Edge> + '_
pub fn iter_edges(&self) -> impl Iterator<Item = Edge> + '_
Returns an iterator over all edges in the database.
Useful for dump/export operations.
Source§impl GrafeoDB
impl GrafeoDB
Sourcepub fn execute(&self, query: &str) -> Result<QueryResult>
pub fn execute(&self, query: &str) -> Result<QueryResult>
Sourcepub fn execute_at_epoch(
&self,
query: &str,
epoch: EpochId,
) -> Result<QueryResult>
pub fn execute_at_epoch( &self, query: &str, epoch: EpochId, ) -> Result<QueryResult>
Executes a GQL query with visibility at the specified epoch.
This enables time-travel queries: the query sees the database as it existed at the given epoch.
§Errors
Returns an error if parsing or execution fails.
Sourcepub fn execute_with_params(
&self,
query: &str,
params: HashMap<String, Value>,
) -> Result<QueryResult>
pub fn execute_with_params( &self, query: &str, params: HashMap<String, Value>, ) -> Result<QueryResult>
Executes a query with parameters and returns the result.
§Errors
Returns an error if the query fails.
Sourcepub fn execute_language(
&self,
query: &str,
language: &str,
params: Option<HashMap<String, Value>>,
) -> Result<QueryResult>
pub fn execute_language( &self, query: &str, language: &str, params: Option<HashMap<String, Value>>, ) -> Result<QueryResult>
Executes a query in the specified language by name.
Supported language names: "gql", "cypher", "gremlin", "graphql",
"sparql", "sql". Each requires the corresponding feature flag.
§Errors
Returns an error if the language is unknown/disabled, or if the query fails.
Source§impl GrafeoDB
impl GrafeoDB
Sourcepub fn new_in_memory() -> Self
pub fn new_in_memory() -> Self
Creates an in-memory database - fast to create, gone when dropped.
Use this for tests, experiments, or when you don’t need persistence.
For data that survives restarts, use open() instead.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
let session = db.session();
session.execute("INSERT (:Person {name: 'Alix'})")?;Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Opens a database at the given path, creating it if it doesn’t exist.
If you’ve used this path before, Grafeo recovers your data from the write-ahead log automatically. First open on a new path creates an empty database.
§Errors
Returns an error if the path isn’t writable or recovery fails.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::open("./my_social_network")?;Sourcepub fn with_config(config: Config) -> Result<Self>
pub fn with_config(config: Config) -> Result<Self>
Creates a database with custom configuration.
Use this when you need fine-grained control over memory limits,
thread counts, or persistence settings. For most cases,
new_in_memory() or open()
are simpler.
§Errors
Returns an error if the database can’t be created or recovery fails.
§Examples
use grafeo_engine::{GrafeoDB, Config};
// In-memory with a 512MB limit
let config = Config::in_memory()
.with_memory_limit(512 * 1024 * 1024);
let db = GrafeoDB::with_config(config)?;Sourcepub fn with_store(store: Arc<dyn GraphStoreMut>, config: Config) -> Result<Self>
pub fn with_store(store: Arc<dyn GraphStoreMut>, config: Config) -> Result<Self>
Creates a database backed by a custom GraphStoreMut implementation.
The external store handles all data persistence. WAL, CDC, and index management are the responsibility of the store implementation.
Query execution (all 6 languages, optimizer, planner) works through the provided store. Admin operations (schema introspection, persistence, vector/text indexes) are not available on external stores.
§Examples
use std::sync::Arc;
use grafeo_engine::{GrafeoDB, Config};
use grafeo_core::graph::GraphStoreMut;
fn example(store: Arc<dyn GraphStoreMut>) -> grafeo_common::utils::error::Result<()> {
let db = GrafeoDB::with_store(store, Config::in_memory())?;
let result = db.execute("MATCH (n) RETURN count(n)")?;
Ok(())
}Sourcepub fn session(&self) -> Session
pub fn session(&self) -> Session
Opens a new session for running queries.
Sessions are cheap to create - spin up as many as you need. Each gets its own transaction context, so concurrent sessions won’t block each other on reads.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
let session = db.session();
// Run queries through the session
let result = session.execute("MATCH (n) RETURN count(n)")?;Sourcepub fn adaptive_config(&self) -> &AdaptiveConfig
pub fn adaptive_config(&self) -> &AdaptiveConfig
Returns the adaptive execution configuration.
Sourcepub fn graph_model(&self) -> GraphModel
pub fn graph_model(&self) -> GraphModel
Returns the graph data model of this database.
Sourcepub fn memory_limit(&self) -> Option<usize>
pub fn memory_limit(&self) -> Option<usize>
Returns the configured memory limit in bytes, if any.
Sourcepub fn store(&self) -> &Arc<LpgStore>
pub fn store(&self) -> &Arc<LpgStore>
Returns the underlying store.
This provides direct access to the LPG store for algorithm implementations and admin operations (index management, schema introspection, MVCC internals).
For code that only needs read/write graph operations, prefer
graph_store() which returns the trait interface.
Sourcepub fn create_graph(&self, name: &str) -> Result<bool>
pub fn create_graph(&self, name: &str) -> Result<bool>
Creates a named graph. Returns true if created, false if it already exists.
§Errors
Returns an error if arena allocation fails.
Sourcepub fn drop_graph(&self, name: &str) -> bool
pub fn drop_graph(&self, name: &str) -> bool
Drops a named graph. Returns true if dropped, false if it did not exist.
Sourcepub fn list_graphs(&self) -> Vec<String>
pub fn list_graphs(&self) -> Vec<String>
Returns all named graph names.
Sourcepub fn graph_store(&self) -> Arc<dyn GraphStoreMut>
pub fn graph_store(&self) -> Arc<dyn GraphStoreMut>
Returns the graph store as a trait object.
This provides the GraphStoreMut interface for code that should work
with any storage backend. Use this when you only need graph read/write
operations and don’t need admin methods like index management.
Sourcepub fn gc(&self)
pub fn gc(&self)
Garbage collects old MVCC versions that are no longer visible.
Determines the minimum epoch required by active transactions and prunes version chains older than that threshold. Also cleans up completed transaction metadata in the transaction manager.
Sourcepub fn buffer_manager(&self) -> &Arc<BufferManager>
pub fn buffer_manager(&self) -> &Arc<BufferManager>
Returns the buffer manager for memory-aware operations.
Sourcepub fn query_cache(&self) -> &Arc<QueryCache>
pub fn query_cache(&self) -> &Arc<QueryCache>
Returns the query cache.
Sourcepub fn close(&self) -> Result<()>
pub fn close(&self) -> Result<()>
Closes the database, flushing all pending writes.
For persistent databases, this ensures everything is safely on disk. Called automatically when the database is dropped, but you can call it explicitly if you need to guarantee durability at a specific point.
§Errors
Returns an error if the WAL can’t be flushed (check disk space/permissions).
Trait Implementations§
Source§impl AdminService for GrafeoDB
impl AdminService for GrafeoDB
Source§fn info(&self) -> DatabaseInfo
fn info(&self) -> DatabaseInfo
Source§fn detailed_stats(&self) -> DatabaseStats
fn detailed_stats(&self) -> DatabaseStats
Source§fn schema(&self) -> SchemaInfo
fn schema(&self) -> SchemaInfo
Source§fn validate(&self) -> ValidationResult
fn validate(&self) -> ValidationResult
Source§fn wal_status(&self) -> WalStatus
fn wal_status(&self) -> WalStatus
Auto Trait Implementations§
impl !Freeze for GrafeoDB
impl !RefUnwindSafe for GrafeoDB
impl Send for GrafeoDB
impl Sync for GrafeoDB
impl Unpin for GrafeoDB
impl UnsafeUnpin for GrafeoDB
impl !UnwindSafe for GrafeoDB
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more