Struct List

Source
pub struct List {
    pub path: Option<String>,
    pub lines: Vec<Line>,
}
Expand description

A todo list.

Fields§

§path: Option<String>§lines: Vec<Line>

Implementations§

Source§

impl List

Source

pub fn new() -> Self

Source

pub fn from_items(lines: Vec<&Item>) -> Self

Source

pub fn from_url(u: String) -> Result<Self, Error>

Parse a todo list from a URL.

Source

pub fn from_filename(path: String) -> Result<Self, Error>

Parse a todo list from a filename.

Source

pub fn from_file(f: File) -> Result<Self, Error>

Parse a todo list from an open file.

Source

pub fn from_string(s: String) -> Result<Self, Error>

Parse a todo list from a string.

Source

pub fn from_http(url: Url) -> Result<Self, Error>

Read a todo list over HTTP.

Source

pub fn to_url(&self, u: String)

Source

pub fn to_filename(&self, path: String)

Save a todo list to a filename.

Source

pub fn to_file(&self, f: File)

Save a todo list to a file.

Source

pub fn to_http(&self, url: Url)

Save a todo list using an HTTP PUT request.

Source

pub fn serialize(&self) -> String

Serialize a todo list as a string.

Source

pub fn append_lines_to_url(u: String, lines: Vec<&Line>)

Appends some lines to a todo list, given its filename.

Source

pub fn items(&self) -> Vec<&Item>

Get a Vec<&Item> from an already-parsed file.

Source

pub fn count_items(&self) -> usize

Count the items in the list.

Source

pub fn count_blank(&self) -> usize

Count the blank/comment lines in the list.

Source

pub fn count_completed(&self) -> usize

Count the completed items in the list.

Source

pub fn but_tidy(&self, sort_order: &SortOrder) -> Self

Clone the list, but removing blank lines and comments, and optionally sort it.

Trait Implementations§

Source§

impl Debug for List

Source§

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

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

impl Default for List

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for List

§

impl RefUnwindSafe for List

§

impl Send for List

§

impl Sync for List

§

impl Unpin for List

§

impl UnwindSafe for List

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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