pub struct Request {
pub selector: String,
pub query: String,
pub root: String,
pub host: String,
pub port: u16,
}
Expand description
This struct represents a single gopher request.
Fields§
§selector: String
Gopher selector requested
query: String
Search query string, if any.
root: String
Root directory of the server. Can’t serve outside of this.
host: String
Host of the currently running server.
port: u16
Port of the currently running server.
Implementations§
Source§impl Request
impl Request
Sourcepub fn from(host: &str, port: u16, root: &str) -> Result<Request>
pub fn from(host: &str, port: u16, root: &str) -> Result<Request>
Try to create a new request state object.
Sourcepub fn relative_file_path(&self) -> String
pub fn relative_file_path(&self) -> String
Path to the target file relative to the server root.
Sourcepub fn parse_request(&mut self, line: &str)
pub fn parse_request(&mut self, line: &str)
Set selector + query based on what the client sent.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnwindSafe for Request
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