Struct fwupd_dbus::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)
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
fn main_() -> Result<(), Box<dyn Error>> {
    // Atomic value used to stop the background thread.
    let cancellable = Arc::new(AtomicBool::new(true));

    // Begin listening to signals in the background
    listen_in_background(cancellable.clone());

    // Create a new dbus client connection.
    let fwupd = &Client::new()?;

    println!("Version: {}", fwupd.daemon_version()?);
    println!("Status: {:?}", fwupd.status()?);
    println!("Tainted: {}", fwupd.tainted()?);
    if let Ok(percent) = fwupd.percentage() {
        println!("Percentage; {}", percent);
    }

    // Fetch a list of supported devices.
    for device in fwupd.devices()? {
        println!("Device: {:#?}", device);

        if device.is_updateable() {
            if let Ok(upgrades) = fwupd.upgrades(&device) {
                println!("  upgrades found");
                for upgrade in upgrades {
                    println!("{:#?}", upgrade);
                }
            } else {
                println!("  no updates available");
            }

            if let Ok(downgrades) = fwupd.downgrades(&device) {
                println!("  downgrades found");
                for downgrade in downgrades {
                    println!("{:#?}", downgrade);
                }
            }

            if let Ok(releases) = fwupd.releases(&device) {
                println!("   releases found");
                for release in releases {
                    println!("{:#?}", release);
                }
            }
        } else {
            println!("  device not updateable");
        }
    }

    // Fetch a list of remotes, and update them.
    for remote in fwupd.remotes()? {
        println!("{:#?}", remote);

        remote.update_metadata(fwupd)?;
    }

    loop {
        std::thread::sleep(Duration::from_secs(1));
    }

    // Stop listening to signals in the background.
    cancellable.store(true, Ordering::SeqCst);

    Ok(())
}
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 copy of the value. Read more
1.0.0 · source§

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, Global>>)> for Remote

source§

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

Creates a value from an iterator. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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.

§

impl<T> NoneValue for Twhere T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

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