Skip to main content

Session

Struct Session 

Source
pub struct Session {
    pub comments: Vec<Comment>,
    pub viewed: BTreeMap<String, String>,
    pub walkthrough: Option<Walkthrough>,
    pub seen_stops: BTreeSet<String>,
}

Fields§

§comments: Vec<Comment>§viewed: BTreeMap<String, String>

Per-file viewed marks: path -> content hash of the new side at the time of marking. A changed hash means the file needs re-review.

§walkthrough: Option<Walkthrough>

The walkthrough this session is, when its source is ReviewSource::Walkthrough. Every comment in comments above is this walkthrough’s: its stops, their notes, and every human reply made on it. None for every other source.

§seen_stops: BTreeSet<String>

Walkthrough stops (comment ids) the reader has marked read. Pruned to the current walkthrough’s stops on every change, so a stop id from a superseded revision never lingers.

Implementations§

Source§

impl Session

Source

pub fn add_comment( &mut self, anchor: Anchor, author: &str, body: &str, ) -> &Comment

Source

pub fn set_walkthrough(&mut self, walkthrough: Walkthrough)

Set this session’s walkthrough, replacing whatever it held before, and prune seen marks for stops it no longer carries.

Source

pub fn delete_stop(&mut self, index: usize) -> bool

Remove one stop and its notes, keeping the walkthrough and its other stops. false when there is no walkthrough or index is out of range.

Source

pub fn mark_stop_seen(&mut self, id: &str)

Mark a walkthrough stop read.

Source

pub fn unmark_stop_seen(&mut self, id: &str)

Source

pub fn is_stop_seen(&self, id: &str) -> bool

Source

pub fn delete_comment(&mut self, id: &str) -> bool

Remove the comment with id; true when something was deleted.

Source

pub fn reply(&mut self, comment_id: &str, author: &str, body: &str) -> bool

Source

pub fn comment(&self, id: &str) -> Option<&Comment>

Source

pub fn mark_replied(&mut self, comment_id: &str) -> bool

Flag a comment as addressed without writing anything into the thread. An agent that already answered has said its piece; a second summary of it is noise in the card.

Source

pub fn resolve(&mut self, comment_id: &str) -> bool

Source

pub fn edit_comment(&mut self, comment_id: &str, body: &str) -> bool

Replace a comment’s body in place (status, replies, and anchor are kept). No author: an edit corrects the existing comment, it doesn’t attribute a new one.

Source

pub fn mark_viewed(&mut self, path: &str, hash: &str)

Source

pub fn unmark_viewed(&mut self, path: &str)

Source

pub fn clear_viewed(&mut self)

Drop every viewed mark, sending all files back to the review pile.

Source

pub fn is_viewed(&self, path: &str, current_hash: &str) -> bool

A stale hash means the file changed since it was marked: not viewed anymore (auto-reset semantics).

Source

pub fn reconcile(&mut self, model: &DiffModel)

Drop viewed marks for files that left the diff or whose content changed since marking. Comments are kept: they stay useful (possibly flagged outdated) even when their file moves on.

Trait Implementations§

Source§

impl Clone for Session

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Session

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Session

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Session

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Session

Source§

impl PartialEq for Session

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Session

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Session

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, dest: *mut u8)

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

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

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.