Struct Remote

Source
pub struct Remote {
Show 17 fields pub agreement: Option<Box<str>>, pub approval_required: bool, pub checksum: Option<Box<str>>, pub enabled: bool, pub filename_cache: Box<str>, pub filename_source: Box<str>, pub firmware_base_uri: Option<Box<str>>, pub keyring: KeyringKind, pub kind: RemoteKind, pub modification_time: u64, pub password: Option<Box<str>>, pub priority: i16, pub remote_id: RemoteId, pub report_uri: Option<Box<str>>, pub title: Box<str>, pub uri: Option<Box<str>>, pub username: Option<Box<str>>,
}
Expand description

Information about an available fwupd remote.

Fields§

§agreement: Option<Box<str>>§approval_required: bool§checksum: Option<Box<str>>§enabled: bool§filename_cache: Box<str>§filename_source: Box<str>§firmware_base_uri: Option<Box<str>>§keyring: KeyringKind§kind: RemoteKind§modification_time: u64§password: Option<Box<str>>§priority: i16§remote_id: RemoteId§report_uri: Option<Box<str>>§title: Box<str>§uri: Option<Box<str>>§username: Option<Box<str>>

Implementations§

Source§

impl Remote

Source

pub fn update_metadata(&self, client: &Client) -> Result<(), UpdateError>

Updates the metadata for this remote.

Examples found in repository?
examples/example.rs (line 80)
27fn main_() -> Result<(), Box<dyn Error>> {
28    // Atomic value used to stop the background thread.
29    let cancellable = Arc::new(AtomicBool::new(true));
30
31    // Begin listening to signals in the background
32    listen_in_background(cancellable.clone());
33
34    // Create a new dbus client connection.
35    let fwupd = &Client::new()?;
36
37    println!("Version: {}", fwupd.daemon_version()?);
38    println!("Status: {:?}", fwupd.status()?);
39    println!("Tainted: {}", fwupd.tainted()?);
40    if let Ok(percent) = fwupd.percentage() {
41        println!("Percentage; {}", percent);
42    }
43
44    // Fetch a list of supported devices.
45    for device in fwupd.devices()? {
46        println!("Device: {:#?}", device);
47
48        if device.is_updateable() {
49            if let Ok(upgrades) = fwupd.upgrades(&device) {
50                println!("  upgrades found");
51                for upgrade in upgrades {
52                    println!("{:#?}", upgrade);
53                }
54            } else {
55                println!("  no updates available");
56            }
57
58            if let Ok(downgrades) = fwupd.downgrades(&device) {
59                println!("  downgrades found");
60                for downgrade in downgrades {
61                    println!("{:#?}", downgrade);
62                }
63            }
64
65            if let Ok(releases) = fwupd.releases(&device) {
66                println!("   releases found");
67                for release in releases {
68                    println!("{:#?}", release);
69                }
70            }
71        } else {
72            println!("  device not updateable");
73        }
74    }
75
76    // Fetch a list of remotes, and update them.
77    for remote in fwupd.remotes()? {
78        println!("{:#?}", remote);
79
80        remote.update_metadata(fwupd)?;
81    }
82
83    loop {
84        std::thread::sleep(Duration::from_secs(1));
85    }
86
87    // Stop listening to signals in the background.
88    cancellable.store(true, Ordering::SeqCst);
89
90    Ok(())
91}
Source

pub fn time_since_last_update(&self) -> Option<Duration>

Fetch the time since the last update, if such a time can be fetched.

Trait Implementations§

Source§

impl AsRef<RemoteId> for Remote

Source§

fn as_ref(&self) -> &RemoteId

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Remote

Source§

fn clone(&self) -> Remote

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Remote

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Remote

Source§

fn default() -> Remote

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

impl FromIterator<(String, Variant<Box<dyn RefArg>>)> for Remote

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = DBusEntry>,

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl Freeze for Remote

§

impl RefUnwindSafe for Remote

§

impl Send for Remote

§

impl Sync for Remote

§

impl Unpin for Remote

§

impl UnwindSafe for Remote

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,