diff options
Diffstat (limited to 'schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs')
| -rw-r--r-- | schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs b/schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs new file mode 100644 index 0000000..79b0ba9 --- /dev/null +++ b/schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs @@ -0,0 +1,28 @@ +use bucket_name_and_balance::BucketNameAndBalance; +use iced::Element; +use schist_models::Bucket; + +use crate::gui::components::navigation; + +mod bucket_name_and_balance; + +#[derive(Clone, Debug, PartialEq)] +pub struct BucketNavigationEntry(BucketNameAndBalance); + +impl BucketNavigationEntry { + pub fn from_bucket(bucket: &Bucket) -> Self { + Self(BucketNameAndBalance::new(bucket)) + } + + pub fn to_string(&self) -> String { + self.0.bucket.name.clone() + } +} + +impl<'a> From<&'a BucketNavigationEntry> + for Element<'a, navigation::Message<BucketNavigationEntry>> +{ + fn from(bucket_navigation_entry: &'a BucketNavigationEntry) -> Self { + (&bucket_navigation_entry.0).into() + } +} |
