feat(cli): ✨ gridselector: GridItem to String
This commit is contained in:
parent
00f231d79f
commit
f508cd9194
@ -12,10 +12,6 @@ use ratatui::text::Text;
|
||||
pub struct GridItem(String);
|
||||
|
||||
impl GridItem {
|
||||
// pub fn new(value: String) -> Self {
|
||||
// Label(value)
|
||||
// }
|
||||
|
||||
// accept both String and &str
|
||||
pub fn new<S>(value: S) -> Self
|
||||
where
|
||||
@ -25,13 +21,20 @@ impl GridItem {
|
||||
}
|
||||
}
|
||||
|
||||
// implement a way to convert Label into &str
|
||||
// convert Label into &str
|
||||
impl AsRef<str> for GridItem {
|
||||
fn as_ref(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
// convert Label into String
|
||||
impl Into<String> for GridItem {
|
||||
fn into(self) -> String {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
// Specify the lifetime for the implementation
|
||||
impl<'a> From<GridItem> for Text<'a> {
|
||||
fn from(val: GridItem) -> Self {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user