pub struct Gopher { /* private fields */ }
Expand description
The Gopher struct represents an initialized object ready to connect.
Implementations§
Source§impl Gopher
impl Gopher
Sourcepub fn new(endpoint: &str) -> Result<Self, GopherError>
pub fn new(endpoint: &str) -> Result<Self, GopherError>
Create a new Gopher
object with the given endpoint.
§Example
use gophers::Gopher;
let gopher = Gopher::new("gophers://bitreich.org").unwrap();
Sourcepub fn connect(&self) -> Result<GopherConnection, GopherError>
pub fn connect(&self) -> Result<GopherConnection, GopherError>
Establish a connection with a created Gopher object.
Depending on tls
, it will establish either a plain TCP or an
encrypted TLS connection.
§Example
use gophers::Gopher;
let gopher = Gopher::new("gophers://bitreich.org").unwrap();
let mut stream = gopher.connect().unwrap();
Auto Trait Implementations§
impl Freeze for Gopher
impl RefUnwindSafe for Gopher
impl Send for Gopher
impl Sync for Gopher
impl Unpin for Gopher
impl UnwindSafe for Gopher
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