pub struct Watchlist {
pub domains: Vec<String>,
}Expand description
Persistent list of domains to monitor.
Fields§
§domains: Vec<String>Implementations§
Source§impl Watchlist
impl Watchlist
Sourcepub fn path() -> Option<PathBuf>
pub fn path() -> Option<PathBuf>
Returns the path to the watchlist file (~/.seer/watchlist.toml).
Sourcepub fn load() -> Self
pub fn load() -> Self
Loads the watchlist from disk, returning an empty list on any failure.
When the file exists but fails to parse, it is renamed to
<path>.corrupt (preserving the user’s data for recovery/forensics)
and a warning is logged — previously the file was silently
overwritten on the next save, dropping the user’s watchlist.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Persists the watchlist to disk via write-and-rename so a crash mid-write
cannot leave the file truncated (the next load() would see corrupt
TOML and silently fall back to the default empty watchlist, losing
the user’s domains). Mirrors LookupHistory::save.
The temp filename is suffixed with the current PID so two concurrent
seer processes don’t write to the same intermediate path and race
each other’s renames.
§Concurrency
As with crate::history::LookupHistory::save, the write is atomic but
the load → add/remove → save cycle is not cross-process locked: two
concurrent writers can lose one side’s add/remove (last-writer-wins). No
corruption occurs. A cross-process advisory lock would close the window;
it is omitted to avoid a new dependency for a low-frequency edge case.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Watchlist
impl<'de> Deserialize<'de> for Watchlist
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Watchlist
impl RefUnwindSafe for Watchlist
impl Send for Watchlist
impl Sync for Watchlist
impl Unpin for Watchlist
impl UnsafeUnpin for Watchlist
impl UnwindSafe for Watchlist
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more