Todo

Struct Todo 

Source
pub struct Todo {
    pub id: u32,
    pub name: String,
    pub done: bool,
    pub github: Option<GitHub>,
}
Expand description

Data Structure for a simple todo.

A Todo item is the atomic unit within the tdo microcosm. It represents a single todo or task, which is identified by an ID. Information about its state (done or undone) can be derived from the data structure as well as the title of the todo item.

Fields§

§id: u32

Unique identifier for every Todo.

§name: String

Title of the todo.

§done: bool

Status of the todo.

§github: Option<GitHub>

Optional GitHub issue.

Implementations§

Source§

impl Todo

Source

pub fn new(id: u32, name: &str, github: Option<GitHub>) -> Todo

Constructor. Creates a new Todo item.

Source

pub fn edit(&mut self, new_name: &str)

Edit the title of a given Todo.

Source

pub fn set_done(&mut self)

Set the status of a Todo item to done.

Source

pub fn set_undone(&mut self)

Mark a todo item as undone.

Trait Implementations§

Source§

impl Clone for Todo

Source§

fn clone(&self) -> Todo

Returns a duplicate 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 Todo

Source§

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

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

impl Deserialize for Todo

Source§

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

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

impl Serialize for Todo

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

Auto Trait Implementations§

§

impl Freeze for Todo

§

impl RefUnwindSafe for Todo

§

impl Send for Todo

§

impl Sync for Todo

§

impl Unpin for Todo

§

impl UnwindSafe for Todo

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> 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> ToJson for T
where T: Serialize + ?Sized,

Source§

fn to_json(&self) -> Result<Value, Error>

Represent self as a serde_json::Value. Note that Value is not a JSON string. If you need a string, use serde_json::to_string instead. Read more
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.