pub struct FirefoxPreference {
pub key: String,
pub value: PreferenceValue,
pub comment: Option<String>,
}Expand description
A Firefox preference with a name and value.
§Examples
use firefox_webdriver::driver::profile::{FirefoxPreference, PreferenceValue};
// Simple preference
let pref = FirefoxPreference::new("browser.startup.page", PreferenceValue::Int(0));
// With comment
let pref = FirefoxPreference::new("app.update.enabled", false)
.with_comment("Disable auto-updates");Fields§
§key: StringPreference name (e.g., “browser.startup.page”).
value: PreferenceValuePreference value.
comment: Option<String>Optional comment explaining the preference.
Implementations§
Source§impl FirefoxPreference
impl FirefoxPreference
Sourcepub fn new(key: impl Into<String>, value: impl Into<PreferenceValue>) -> Self
pub fn new(key: impl Into<String>, value: impl Into<PreferenceValue>) -> Self
Creates a new preference.
§Arguments
key- Preference name (e.g., “browser.startup.page”)value- Preference value
Sourcepub fn with_comment(self, comment: impl Into<String>) -> Self
pub fn with_comment(self, comment: impl Into<String>) -> Self
Adds a comment to the preference.
Comments appear as // comment above the preference line.
§Arguments
comment- Comment text
Sourcepub fn to_user_pref_line(&self) -> String
pub fn to_user_pref_line(&self) -> String
Generates the user_pref("key", value); line.
If a comment is set, it appears on the line above.
§Example Output
// Disable auto-updates
user_pref("app.update.enabled", false);Trait Implementations§
Source§impl Clone for FirefoxPreference
impl Clone for FirefoxPreference
Source§fn clone(&self) -> FirefoxPreference
fn clone(&self) -> FirefoxPreference
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FirefoxPreference
impl RefUnwindSafe for FirefoxPreference
impl Send for FirefoxPreference
impl Sync for FirefoxPreference
impl Unpin for FirefoxPreference
impl UnwindSafe for FirefoxPreference
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