Skip to content

Commit

Permalink
Option: new api clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-kolarik committed Dec 30, 2023
1 parent 0b8582f commit 43b3e39
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ impl<T> Deref for MutableOption<T> {
}

impl<T> MutableOption<T> {
pub fn new_empty() -> Self {
Self(Mutable::new(None))
pub fn new(value: Option<T>) -> Self {
Self(Mutable::new(value))
}

pub fn new_some(value: T) -> Self {
Self(Mutable::new(Some(value)))
}

pub fn new_default() -> Self
Expand All @@ -39,14 +43,6 @@ impl<T> MutableOption<T> {
Self(Mutable::new(Some(T::default())))
}

pub fn new_value(value: Option<T>) -> Self {
Self(Mutable::new(value))
}

pub fn new_some_value(value: T) -> Self {
Self(Mutable::new(Some(value)))
}

pub fn is_none(&self) -> bool {
self.0.lock_ref().is_none()
}
Expand Down

0 comments on commit 43b3e39

Please sign in to comment.