Struct GopherEntry

Source
pub struct GopherEntry<'a> {
    pub item_type: ItemType,
    pub display_string: &'a str,
    pub selector: &'a str,
    pub host: &'a str,
    pub port: u16,
}
Expand description

A single entry in a Gopher map. This struct can be filled in order to generate Gopher responses. It can also be the result of parsing one.

Fields§

§item_type: ItemType

The type of the link

§display_string: &'a str

The human-readable description of the link. Displayed on the UI.

§selector: &'a str

The target page (selector) of the link

§host: &'a str

The host for the target of the link

§port: u16

The port for the target of the link

Implementations§

Source§

impl<'a> GopherEntry<'a>

Source

pub fn from(line: &'a str) -> Option<Self>

Parse a line into a Gopher directory entry.

use gophermap::GopherEntry;
let entry = GopherEntry::from("1Floodgap Home	/home	gopher.floodgap.com	70\r\n")
    .unwrap();
assert_eq!(entry.selector, "/home");
Source

pub fn write<W>(&self, buf: W) -> Result<()>
where W: Write,

Serializes a Gopher entry into bytes. This function can be used to generate Gopher responses.

Auto Trait Implementations§

§

impl<'a> Freeze for GopherEntry<'a>

§

impl<'a> RefUnwindSafe for GopherEntry<'a>

§

impl<'a> Send for GopherEntry<'a>

§

impl<'a> Sync for GopherEntry<'a>

§

impl<'a> Unpin for GopherEntry<'a>

§

impl<'a> UnwindSafe for GopherEntry<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.