1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! GWP: a standalone, pure Rust gRPC wire protocol for GQL (ISO/IEC 39075).
//!
//! This crate provides the protobuf type definitions, gRPC service
//! implementations, and client library for communicating GQL queries
//! and results over the wire.
//!
//! # Quick start (server)
//!
//! ```rust,no_run
//! use std::net::SocketAddr;
//! use gwp::server::{GqlServer, GqlBackend};
//!
//! # async fn example(backend: impl GqlBackend) -> Result<(), tonic::transport::Error> {
//! let addr: SocketAddr = "0.0.0.0:7687".parse().unwrap();
//!
//! GqlServer::builder(backend)
//! .max_sessions(128)
//! .shutdown(async { drop(tokio::signal::ctrl_c().await) })
//! .serve(addr)
//! .await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Quick start (client)
//!
//! ```rust,no_run
//! use gwp::client::GqlConnection;
//!
//! # async fn example() -> Result<(), gwp::error::GqlError> {
//! let mut conn = GqlConnection::connect("http://localhost:7687").await?;
//! let mut session = conn.create_session().await?;
//!
//! let mut cursor = session.execute_simple("MATCH (n:Person) RETURN n.name").await?;
//! let rows = cursor.collect_rows().await?;
//!
//! for row in &rows {
//! println!("{:?}", row);
//! }
//!
//! session.close().await?;
//! # Ok(())
//! # }
//! ```