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
impl Remote
sourcepub fn update_metadata(&self, client: &Client) -> Result<(), UpdateError>
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(())
}
sourcepub fn time_since_last_update(&self) -> Option<Duration>
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§
Auto Trait Implementations§
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> 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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.