Struct smf::Query[][src]

pub struct Query { /* fields omitted */ }

Queries the underlying system to return SvcStatus structures.

Acts as a wrapper around the underlying ‘svcs’ command.

Implementations

impl Query[src]

pub fn new() -> Query[src]

Creates a new query object.

pub fn zone<S: AsRef<str>>(&mut self, zone: S) -> &mut Query[src]

Requests a query be issued within a specific zone.

pub fn get_status_all(
    &self
) -> Result<impl Iterator<Item = SvcStatus>, QueryError>
[src]

Syntactic sugar for Query::get_status with a selection of QuerySelection::All.

See: The corresponding Rust issue on inferred default types for more context on why this method exists - it is more ergonomic than invoking Self::get_status with QuerySelection::All directly.

pub fn get_status<S, I>(
    &self,
    selection: QuerySelection<S, I>
) -> Result<impl Iterator<Item = SvcStatus>, QueryError> where
    S: AsRef<str>,
    I: IntoIterator<Item = S>, 
[src]

Queries for status information from the corresponding query.

Returns status information for all services which match the QuerySelection argument.

pub fn get_dependencies_of<S, I>(
    &self,
    patterns: I
) -> Result<impl Iterator<Item = SvcStatus>, QueryError> where
    S: AsRef<str>,
    I: IntoIterator<Item = S>, 
[src]

Returns the statuses of service instances upon which the provided instances depend.

let service_statuses = smf::Query::new()
    .get_dependencies_of(&["svcs:/system/filesystem/minimal"])
    .unwrap();
// `service_statuses` includes services which boot before the
// minimal filesystem.

pub fn get_dependents_of<S, I>(
    &self,
    patterns: I
) -> Result<impl Iterator<Item = SvcStatus>, QueryError> where
    S: AsRef<str>,
    I: IntoIterator<Item = S>, 
[src]

Returns the statuses of service instances that depend on the provided instances.

let service_statuses = smf::Query::new()
    .get_dependents_of(&["svcs:/system/filesystem/minimal"])
    .unwrap();
// `service_statuses` includes services which need a minimal
// filesystem.

pub fn get_log_files<S, I>(
    &self,
    patterns: I
) -> Result<impl Iterator<Item = PathBuf>, QueryError> where
    S: AsRef<str>,
    I: IntoIterator<Item = S>, 
[src]

Acquires the log files for services which match the provided FMRIs or glob patterns.

let log_file = smf::Query::new()
    .get_log_files(vec!["svc:/system/filesystem/minimal"]).unwrap()
    .next().unwrap();

Trait Implementations

impl Default for Query[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

impl RefUnwindSafe for Query

impl Send for Query

impl Sync for Query

impl Unpin for Query

impl UnwindSafe for Query

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

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

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

The type returned in the event of a conversion error.

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

Performs the conversion.