pub struct Vertex { /* private fields */ }
Implementations§
Source§impl Vertex
impl Vertex
Sourcepub fn id(&self) -> &GID
pub fn id(&self) -> &GID
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 21)
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}
Sourcepub fn label(&self) -> &String
pub fn label(&self) -> &String
Examples found in repository?
examples/vertex.rs (line 19)
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}
pub fn iter(&self) -> Iter<'_, String, Vec<VertexProperty>>
pub fn property(&self, key: &str) -> Option<&VertexProperty>
Trait Implementations§
Source§impl IntoIterator for Vertex
impl IntoIterator for Vertex
impl Eq for Vertex
Auto Trait Implementations§
impl Freeze for Vertex
impl RefUnwindSafe for Vertex
impl Send for Vertex
impl Sync for Vertex
impl Unpin for Vertex
impl UnwindSafe for Vertex
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