Struct fahapi::API[][src]

pub struct API {
    pub conn: Connection,
    pub buf: Vec<u8>,
}

Wrapper for the FAH API. Use API::connect_timeout() to initialize.

Example

fn example() -> fahapi::Result<()> {
    let mut api = fahapi::API::connect_timeout(&fahapi::DEFAULT_ADDR, std::time::Duration::from_secs(1))?;
    api.pause_all()?;
    api.unpause_all()
}

Fields

conn: Connectionbuf: Vec<u8>

Implementations

impl API[src]

pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> Result<API>[src]

Connects to your FAH client with a timeout. DEFAULT_ADDR is the default address.

pub fn help(&mut self) -> Result<String>[src]

Returns a listing of the FAH API commands.

pub fn log_updates(&mut self, arg: LogUpdatesArg) -> Result<String>[src]

Enables or disables log updates. Returns current log.

pub fn screensaver(&mut self) -> Result<()>[src]

Unpauses all slots which are paused waiting for a screensaver and pause them again on disconnect.

pub fn always_on(&mut self, slot: i64) -> Result<()>[src]

Sets a slot to be always on.

pub fn configured(&mut self) -> Result<bool>[src]

Returns true if the client has set a user, team or passkey.

pub fn do_cycle(&mut self) -> Result<()>[src]

Runs one client cycle.

pub fn finish_slot(&mut self, slot: i64) -> Result<()>[src]

Pauses a slot when its current work unit is completed.

pub fn finish_all(&mut self) -> Result<()>[src]

Pauses all slots one-by-one when their current work unit is completed.

pub fn info(&mut self) -> Result<Vec<Vec<Value>>>[src]

Returns FAH build and machine info. See info_struct().

pub fn info_struct(&mut self) -> Result<Info>[src]

Converts Info() data into a structure. Consider this interface to be very unstable.

pub fn num_slots(&mut self) -> Result<i64>[src]

Returns the number of slots.

pub fn on_idle(&mut self, slot: i64) -> Result<()>[src]

Sets a slot to run only when idle.

pub fn on_idle_all(&mut self) -> Result<()>[src]

Sets all slots to run only when idle.

pub fn options_get(&mut self) -> Result<Options>[src]

Returns the FAH client options.

pub fn options_set<N>(&mut self, key: &str, value: N) -> Result<()> where
    N: Display
[src]

Sets an option.

pub fn pause_all(&mut self) -> Result<()>[src]

Pauses all slots.

pub fn pause_slot(&mut self, slot: i64) -> Result<()>[src]

Pauses a slot.

pub fn ppd(&mut self) -> Result<f64>[src]

pub fn queue_info(&mut self) -> Result<Vec<SlotQueueInfo>>[src]

Returns info about the current work unit.

pub fn request_id(&mut self) -> Result<()>[src]

Requests an ID from the assignment server.

pub fn request_ws(&mut self) -> Result<()>[src]

Requests work server assignment from the assignment server.

pub fn shutdown(&mut self) -> Result<()>[src]

Ends all FAH processes.

pub fn simulation_info(&mut self, slot: i64) -> Result<SimulationInfo>[src]

Returns the simulation information for a slot.

pub fn slot_delete(&mut self, slot: i64) -> Result<()>[src]

Deletes a slot.

pub fn slot_info(&mut self) -> Result<Vec<SlotInfo>>[src]

Returns information about each slot.

pub fn slot_options_get(&mut self, slot: i64) -> Result<SlotOptions>[src]

Returns slot options.

pub fn slot_options_set<N>(
    &mut self,
    slot: i64,
    key: &str,
    value: N
) -> Result<()> where
    N: Display
[src]

Sets slot option.

pub fn unpause_all(&mut self) -> Result<()>[src]

Unpauses all slots.

pub fn unpause_slot(&mut self, slot: i64) -> Result<()>[src]

Unpauses a slot.

pub fn uptime(&mut self) -> Result<FAHDuration>[src]

Returns FAH uptime.

pub fn wait_for_units(&mut self) -> Result<()>[src]

Blocks until all slots are paused.

Trait Implementations

impl Debug for API[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.

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.