places::observation

Struct VisitObservation

source
pub struct VisitObservation {
    pub url: Url,
    pub title: Option<String>,
    pub visit_type: Option<VisitType>,
    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<Url>,
    pub is_remote: Option<bool>,
    pub preview_image_url: Option<Url>,
}
Expand description

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: Url§title: Option<String>§visit_type: Option<VisitType>§is_error: Option<bool>§is_redirect_source: Option<bool>§is_permanent_redirect_source: Option<bool>§at: Option<Timestamp>§referrer: Option<Url>§is_remote: Option<bool>§preview_image_url: Option<Url>

Implementations§

source§

impl VisitObservation

source

pub fn new(url: Url) -> Self

source

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

source

pub fn with_visit_type(self, t: impl Into<Option<VisitType>>) -> Self

source

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

source

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

source

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

source

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

source

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

source

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

source

pub fn with_preview_image_url(self, v: impl Into<Option<Url>>) -> Self

source

pub fn get_redirect_frecency_boost(&self) -> bool

source

pub fn get_is_hidden(&self) -> bool

Trait Implementations§

source§

impl Clone for VisitObservation

source§

fn clone(&self) -> VisitObservation

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 VisitObservation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
source§

impl<T, U> Into<U> for T
where 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.

source§

impl<T> ToOwned for T
where T: Clone,

source§

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

source§

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

source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T