pub struct Request {
pub primitive: String,
pub args: Vec<String>,
pub flags: BTreeMap<String, Option<String>>,
}Expand description
One request from the CLI to the daemon.
Fields§
§primitive: StringPrimitive name, e.g. vs_open.
args: Vec<String>Positional arguments, in order.
flags: BTreeMap<String, Option<String>>Flags. None means a bare flag (e.g. --full-page); Some(v)
means --name=v.
Implementations§
Source§impl Request
impl Request
pub fn new(primitive: impl Into<String>) -> Self
pub fn arg(self, value: impl Into<String>) -> Self
pub fn flag(self, name: impl Into<String>) -> Self
pub fn flag_value( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Sourcepub fn encode(&self) -> String
pub fn encode(&self) -> String
Encode the request as a single wire line, including the trailing newline.
Args and flag values are backslash-escaped (\ \n \r \t)
before quoting so a value that itself contains newlines —
e.g. a multiline vs inspect eval expression — survives the
line-framed transport instead of being split into bogus extra
request lines. parse reverses the escaping.
Trait Implementations§
impl Eq for Request
impl StructuralPartialEq for Request
Auto Trait Implementations§
impl Forget for Request
impl Freeze for Request
impl Move for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin 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