[][src]Struct places::observation::VisitObservation

pub struct VisitObservation {
    pub url: String,
    pub title: Option<String>,
    pub visit_type: Option<VisitTransition>,
    pub is_error: Option<bool>,
    pub is_redirect_source: Option<bool>,
    pub is_permanent_redirect_source: Option<bool>,
    pub at: Option<Timestamp>,
    pub referrer: Option<String>,
    pub is_remote: Option<bool>,
}
[]

An "observation" based model for updating history. You create a VisitObservation, call functions on it which correspond with what you observed. The page will then be updated using this info.

It's implemented such that the making of an "observation" is itself significant - it records what specific changes should be made to storage. For example, instead of simple bools with defaults (where you can't differentiate explicitly setting a value from the default value), we use Option, with the idea being it's better for a store shaped like Mentat.

It exposes a "builder api", but for convenience, that API allows Options too. So, eg, .with_title(None) or with_is_error(None) is allowed but records no observation.

Fields

url: String
[]

Ideally, we'd use url::Url here with serde_url, but we really would like to expose these errors over the FFI as UrlParseErrors and not json errors, and we also would like to do so without parsing strings.

title: Option<String>visit_type: Option<VisitTransition>is_error: Option<bool>is_redirect_source: Option<bool>is_permanent_redirect_source: Option<bool>at: Option<Timestamp>referrer: Option<String>
[]

Semantically also a url::Url, See the comment about the url property.

is_remote: Option<bool>

Implementations

impl VisitObservation[src][]

pub fn new(url: Url) -> Self[src]

pub fn with_title(self, t: impl Into<Option<String>>) -> Self[src]

pub fn with_visit_type(self, t: impl Into<Option<VisitTransition>>) -> Self[src]

pub fn with_is_error(self, v: impl Into<Option<bool>>) -> Self[src]

pub fn with_is_redirect_source(self, v: impl Into<Option<bool>>) -> Self[src]

pub fn with_is_permanent_redirect_source(
    self,
    v: impl Into<Option<bool>>
) -> Self
[src]

pub fn with_at(self, v: impl Into<Option<Timestamp>>) -> Self[src]

pub fn with_is_remote(self, v: impl Into<Option<bool>>) -> Self[src]

pub fn with_referrer(self, v: impl Into<Option<Url>>) -> Self[src]

pub fn get_redirect_frecency_boost(&self) -> bool[src]

pub fn get_is_hidden(&self) -> bool[src]

Trait Implementations

impl Debug for VisitObservation[src][+]

impl<'de> Deserialize<'de> for VisitObservation[src][+]

impl Serialize for VisitObservation[src][+]

Auto Trait Implementations

impl RefUnwindSafe for VisitObservation

impl Send for VisitObservation

impl Sync for VisitObservation

impl Unpin for VisitObservation

impl UnwindSafe for VisitObservation

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[+]