pub struct Query {
pub user: Option<String>,
pub hosts: Vec<String>,
pub long: bool,
pub port: u16,
}Expand description
A parsed finger query.
Represents the structured result of parsing a finger query string
like "user@host", "@host", or "user@host1@host2".
Fields§
§user: Option<String>The user to query. None means list all users.
hosts: Vec<String>The host(s) to query. The last host is the connection target. Multiple hosts indicate a forwarding chain (RFC 1288).
long: boolWhether to request verbose output (sends /W prefix).
port: u16TCP port to connect on. Default is 79.
Implementations§
Source§impl Query
impl Query
Sourcepub fn parse(
input: Option<&str>,
long: bool,
port: u16,
) -> Result<Query, QueryError>
pub fn parse( input: Option<&str>, long: bool, port: u16, ) -> Result<Query, QueryError>
Parse a query string into a Query.
Returns an error if any hostname segment is empty (e.g. "user@", "user@@host").
§Examples
use digit::query::Query;
// Standard user query
let q = Query::parse(Some("user@example.com"), false, 79).unwrap();
assert_eq!(q.user, Some("user".to_string()));
assert_eq!(q.target_host(), "example.com");
// Empty hostname is rejected
assert!(Query::parse(Some("user@"), false, 79).is_err());Sourcepub fn target_host(&self) -> &str
pub fn target_host(&self) -> &str
Returns the host to connect to (the last host in the chain).
Trait Implementations§
impl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
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