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)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GremlinClient::connect("localhost")?;
5
6 let results = client
7 .execute("g.V(param)", &[("param", &1)])?
8 .filter_map(Result::ok)
9 .map(|f| f.take::<Vertex>())
10 .collect::<Result<Vec<Vertex>, _>>()?;
11
12 println!("Vertex count: {}", results.len());
13
14 let vertex = &results[0];
15
16 println!(
17 "Vertex with id: [{}] and label: [{}]",
18 vertex.id().get::<i64>()?,
19 vertex.label()
20 );
21
22 Ok(())
23}
More examples
examples/edge.rs (line 19)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GremlinClient::connect("localhost")?;
5
6 // Find outgoing edges for V[1]
7 let results = client
8 .execute("g.V(param).outE()", &[("param", &1)])?
9 .filter_map(Result::ok)
10 .map(|f| f.take::<Edge>())
11 .collect::<Result<Vec<Edge>, _>>()?;
12
13 println!("Edges count {}", results.len());
14
15 let first = &results[0];
16
17 println!(
18 "Edge with id: [{}] and label: [{}] from: [{}] to: [{}]",
19 first.id().get::<i32>()?,
20 first.label(),
21 first.out_v().id().get::<i64>()?,
22 first.in_v().id().get::<i64>()?
23 );
24
25 Ok(())
26}
Trait Implementations§
impl Eq for GID
impl StructuralPartialEq for GID
Auto Trait Implementations§
impl Freeze for GID
impl RefUnwindSafe for GID
impl Send for GID
impl Sync for GID
impl Unpin for GID
impl UnwindSafe for GID
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