Skip to content

Commit

Permalink
Change type_name API
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Aug 29, 2021
1 parent cc8db69 commit d2bf75f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub enum Value {
pub trait ValueType {
fn unwrap(v: Value) -> Self;

fn type_name() -> &'static str;
fn type_name() -> String;
}

#[derive(Clone, Debug, PartialEq)]
Expand Down Expand Up @@ -127,8 +127,8 @@ macro_rules! type_to_value {
}
}

fn type_name() -> &'static str {
stringify!($type)
fn type_name() -> String {
stringify!($type).to_owned()
}
}
};
Expand Down Expand Up @@ -156,8 +156,8 @@ macro_rules! type_to_box_value {
}
}

fn type_name() -> &'static str {
stringify!($type)
fn type_name() -> String {
stringify!($type).to_owned()
}
}
};
Expand Down Expand Up @@ -215,9 +215,8 @@ where T: ValueType + Nullable {
}
}

fn type_name() -> &'static str {
//concat!("Option<", T::type_name(), ">")
T::type_name()
fn type_name() -> String {
format!("Option<{}>", T::type_name())
}
}

Expand Down Expand Up @@ -266,8 +265,8 @@ mod with_chrono {
}
}

fn type_name() -> &'static str {
stringify!(DateTime<FixedOffset>)
fn type_name() -> String {
stringify!(DateTime<FixedOffset>).to_owned()
}
}
}
Expand Down

0 comments on commit d2bf75f

Please sign in to comment.