Struct gremlin_client::Edge
source · pub struct Edge { /* private fields */ }
Implementations§
source§impl Edge
impl Edge
sourcepub fn id(&self) -> &GID
pub fn id(&self) -> &GID
Examples found in repository?
examples/edge.rs (line 19)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
// Find outgoing edges for V[1]
let results = client
.execute("g.V(param).outE()", &[("param", &1)])?
.filter_map(Result::ok)
.map(|f| f.take::<Edge>())
.collect::<Result<Vec<Edge>, _>>()?;
println!("Edges count {}", results.len());
let first = &results[0];
println!(
"Edge with id: [{}] and label: [{}] from: [{}] to: [{}]",
first.id().get::<i32>()?,
first.label(),
first.out_v().id().get::<i64>()?,
first.in_v().id().get::<i64>()?
);
Ok(())
}
sourcepub fn label(&self) -> &String
pub fn label(&self) -> &String
Examples found in repository?
examples/edge.rs (line 20)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
// Find outgoing edges for V[1]
let results = client
.execute("g.V(param).outE()", &[("param", &1)])?
.filter_map(Result::ok)
.map(|f| f.take::<Edge>())
.collect::<Result<Vec<Edge>, _>>()?;
println!("Edges count {}", results.len());
let first = &results[0];
println!(
"Edge with id: [{}] and label: [{}] from: [{}] to: [{}]",
first.id().get::<i32>()?,
first.label(),
first.out_v().id().get::<i64>()?,
first.in_v().id().get::<i64>()?
);
Ok(())
}
sourcepub fn in_v(&self) -> &Vertex
pub fn in_v(&self) -> &Vertex
Examples found in repository?
examples/edge.rs (line 22)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
// Find outgoing edges for V[1]
let results = client
.execute("g.V(param).outE()", &[("param", &1)])?
.filter_map(Result::ok)
.map(|f| f.take::<Edge>())
.collect::<Result<Vec<Edge>, _>>()?;
println!("Edges count {}", results.len());
let first = &results[0];
println!(
"Edge with id: [{}] and label: [{}] from: [{}] to: [{}]",
first.id().get::<i32>()?,
first.label(),
first.out_v().id().get::<i64>()?,
first.in_v().id().get::<i64>()?
);
Ok(())
}
sourcepub fn out_v(&self) -> &Vertex
pub fn out_v(&self) -> &Vertex
Examples found in repository?
examples/edge.rs (line 21)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
// Find outgoing edges for V[1]
let results = client
.execute("g.V(param).outE()", &[("param", &1)])?
.filter_map(Result::ok)
.map(|f| f.take::<Edge>())
.collect::<Result<Vec<Edge>, _>>()?;
println!("Edges count {}", results.len());
let first = &results[0];
println!(
"Edge with id: [{}] and label: [{}] from: [{}] to: [{}]",
first.id().get::<i32>()?,
first.label(),
first.out_v().id().get::<i64>()?,
first.in_v().id().get::<i64>()?
);
Ok(())
}