From e35542ddf3a97dc97cbc1e297851311a83f6b89a Mon Sep 17 00:00:00 2001 From: Alex Kattathra Johnson Date: Fri, 6 Dec 2024 17:07:09 -0600 Subject: [PATCH] Run cargo fmt Signed-off-by: Alex Kattathra Johnson --- src/main.rs | 17 +++++++---------- src/ws/client.rs | 12 ++++++------ src/ws/mod.rs | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8b17983..5225a84 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,11 @@ use std::time::Duration; -use nu_plugin::{EvaluatedCall, JsonSerializer, serve_plugin}; +use nu_plugin::{serve_plugin, EvaluatedCall, JsonSerializer}; use nu_plugin::{EngineInterface, Plugin, PluginCommand}; -use nu_protocol::{ByteStream, ByteStreamType, Category, LabeledError, PipelineData, Signature, SyntaxShape, Type, Value}; +use nu_protocol::{ + ByteStream, ByteStreamType, Category, LabeledError, PipelineData, Signature, SyntaxShape, Type, + Value, +}; mod ws; use ws::client::{connect, http_parse_url, request_headers}; @@ -15,9 +18,7 @@ impl Plugin for WebSocketPlugin { } fn commands(&self) -> Vec>> { - vec![ - Box::new(WebSocket), - ] + vec![Box::new(WebSocket)] } } @@ -80,11 +81,7 @@ impl PluginCommand for WebSocket { .expect("Timeout should be set to duration") as u64, ) }); - if let Some(cr) = connect( - requested_url, - timeout, - request_headers(headers)?, - ) { + if let Some(cr) = connect(requested_url, timeout, request_headers(headers)?) { let reader = Box::new(cr); return Ok(PipelineData::ByteStream( ByteStream::read( diff --git a/src/ws/client.rs b/src/ws/client.rs index 88d7ba3..eb3518c 100644 --- a/src/ws/client.rs +++ b/src/ws/client.rs @@ -100,17 +100,17 @@ pub fn connect( tungstenite::Message::Text(msg) => { if tx.send(msg.as_bytes().to_vec()).is_err() { websocket.close(Some(tungstenite::protocol::CloseFrame{ - code: tungstenite::protocol::frame::coding::CloseCode::Normal, - reason: std::borrow::Cow::Borrowed("byte stream closed"), - })).expect("Could not close connection") + code: tungstenite::protocol::frame::coding::CloseCode::Normal, + reason: std::borrow::Cow::Borrowed("byte stream closed"), + })).expect("Could not close connection") } } tungstenite::Message::Binary(msg) => { if tx.send(msg).is_err() { websocket.close(Some(tungstenite::protocol::CloseFrame{ - code: tungstenite::protocol::frame::coding::CloseCode::Normal, - reason: std::borrow::Cow::Borrowed("byte stream closed"), - })).expect("Could not close connection") + code: tungstenite::protocol::frame::coding::CloseCode::Normal, + reason: std::borrow::Cow::Borrowed("byte stream closed"), + })).expect("Could not close connection") } } tungstenite::Message::Close(..) => { diff --git a/src/ws/mod.rs b/src/ws/mod.rs index 3935517..b9babe5 100644 --- a/src/ws/mod.rs +++ b/src/ws/mod.rs @@ -1 +1 @@ -pub mod client; \ No newline at end of file +pub mod client;