Enum gremlin_client::GID
source · pub enum GID {
String(String),
Int32(i32),
Int64(i64),
}
Variants§
Implementations§
source§impl GID
impl GID
sourcepub fn get<'a, T>(&'a self) -> GremlinResult<&'a T>where
T: BorrowFromGID,
pub fn get<'a, T>(&'a self) -> GremlinResult<&'a T>where
T: BorrowFromGID,
Examples found in repository?
examples/vertex.rs (line 18)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
let results = client
.execute("g.V(param)", &[("param", &1)])?
.filter_map(Result::ok)
.map(|f| f.take::<Vertex>())
.collect::<Result<Vec<Vertex>, _>>()?;
println!("Vertex count: {}", results.len());
let vertex = &results[0];
println!(
"Vertex with id: [{}] and label: [{}]",
vertex.id().get::<i64>()?,
vertex.label()
);
Ok(())
}
More examples
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(())
}