Skip to content

Commit 29bea56

Browse files
authored
Merge pull request #324 from spacey-sooty/cleanup-doc
Cleanup doc import and whitespace
2 parents c799337 + 3f6b0a5 commit 29bea56

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
//!
6868
//! ```no_run
6969
//! use std::io::prelude::*;
70-
//! use std::net::{TcpStream};
70+
//! use std::net::TcpStream;
7171
//! use ssh2::Session;
7272
//!
7373
//! // Connect to the local SSH server
@@ -140,25 +140,25 @@
140140
//! ```
141141
//!
142142
//! ## Execute a Netconf XML payload
143-
//!
143+
//!
144144
//! ```no_run
145145
//! use ssh2::{Channel, Session};
146146
//! use std::error::Error;
147147
//! use std::io::prelude::*;
148148
//! use std::net::TcpStream;
149-
//!
149+
//!
150150
//! const HELLO: &str = "<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">
151151
//! <capabilities>
152152
//! <capability>urn:ietf:params:netconf:base:1.1</capability>
153153
//! </capabilities>
154154
//! </hello>
155155
//! ]]>]]>";
156-
//!
156+
//!
157157
//! const PAYLOAD: &str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
158158
//! <rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.1\" message-id=\"2\">
159159
//! <cli xmlns=\"http://cisco.com/ns/yang/cisco-nx-os-device\"><mode>EXEC</mode><cmdline>show version</cmdline></cli>
160160
//! </rpc>";
161-
//!
161+
//!
162162
//! fn read(channel: &mut Channel) -> Result<String, Box<dyn Error>> {
163163
//! let mut result = String::new();
164164
//! loop {
@@ -183,25 +183,25 @@
183183
//! }
184184
//! Ok(result)
185185
//! }
186-
//!
186+
//!
187187
//! fn main() -> Result<(), Box<dyn Error>> {
188188
//! let tcp = TcpStream::connect("127.0.0.1:830")?;
189189
//! let mut sess = Session::new()?;
190190
//! sess.set_tcp_stream(tcp);
191191
//! sess.handshake().unwrap();
192192
//! sess.userauth_password("user", "pass")?;
193-
//!
193+
//!
194194
//! let mut channel = sess.channel_session()?;
195195
//! channel.subsystem("netconf")?;
196196
//! let result = read(&mut channel)?;
197197
//! println!("Result from connection:\n{}", result);
198-
//!
198+
//!
199199
//! let payload = format!("{}\n#{}\n{}\n##\n", HELLO, PAYLOAD.len(), PAYLOAD);
200200
//! let a = channel.write(payload.as_bytes())?;
201201
//! println!("Written {} bytes payload", a);
202202
//! let result = read(&mut channel)?;
203203
//! println!("Result from payload execution:\n{}", result);
204-
//!
204+
//!
205205
//! channel.send_eof()?;
206206
//! channel.wait_eof()?;
207207
//! channel.close()?;

0 commit comments

Comments
 (0)