[][src]Struct gophermap::GopherEntry

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

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

Methods

impl<'a> GopherEntry<'a>[src]

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

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");

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

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

Auto Trait Implementations

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

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

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]