Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
criminosis committed May 20, 2023
1 parent 7336d46 commit 2eaab4f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
18 changes: 16 additions & 2 deletions gremlin-client/src/aio/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,23 @@ impl Conn {
let websocket_config = opts.websocket_options.as_ref().map(WebSocketConfig::from);

#[cfg(feature = "async-std-runtime")]
let (client, _) = { connect_async_with_tls_connector_and_config(url, tls::connector(&opts), websocket_config).await? };
let (client, _) = {
connect_async_with_tls_connector_and_config(
url,
tls::connector(&opts),
websocket_config,
)
.await?
};
#[cfg(feature = "tokio-runtime")]
let (client, _) = { connect_async_with_tls_connector_and_config(url, tls::connector(&opts), websocket_config).await? };
let (client, _) = {
connect_async_with_tls_connector_and_config(
url,
tls::connector(&opts),
websocket_config,
)
.await?
};

let (sink, stream) = client.split();
let (sender, receiver) = channel(20);
Expand Down
9 changes: 6 additions & 3 deletions gremlin-client/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use native_tls::TlsConnector;
use tungstenite::{
client::{uri_mode, IntoClientRequest},
client_tls_with_config,
protocol::WebSocketConfig,
stream::{MaybeTlsStream, Mode, NoDelay},
Connector, Message, WebSocket, protocol::WebSocketConfig,
Connector, Message, WebSocket,
};

struct ConnectionStream(WebSocket<MaybeTlsStream<TcpStream>>);
Expand Down Expand Up @@ -47,7 +48,10 @@ impl ConnectionStream {
NoDelay::set_nodelay(&mut stream, true)
.map_err(|e| GremlinError::Generic(e.to_string()))?;

let websocket_config = options.websocket_options.as_ref().map(WebSocketConfig::from);
let websocket_config = options
.websocket_options
.as_ref()
.map(WebSocketConfig::from);

let (client, _response) =
client_tls_with_config(options.websocket_url(), stream, websocket_config, connector)
Expand Down Expand Up @@ -202,7 +206,6 @@ impl Default for WebSocketOptions {
}
}


impl From<WebSocketOptions> for tungstenite::protocol::WebSocketConfig {
fn from(value: WebSocketOptions) -> Self {
(&value).into()
Expand Down
5 changes: 4 additions & 1 deletion gremlin-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ mod message;
mod pool;

pub use client::GremlinClient;
pub use connection::{ConnectionOptions, ConnectionOptionsBuilder, TlsOptions, WebSocketOptions, WebSocketOptionsBuilder};
pub use connection::{
ConnectionOptions, ConnectionOptionsBuilder, TlsOptions, WebSocketOptions,
WebSocketOptionsBuilder,
};
pub use conversion::{BorrowFromGValue, FromGValue, ToGValue};
pub use error::GremlinError;
pub use io::GraphSON;
Expand Down

0 comments on commit 2eaab4f

Please sign in to comment.