Trait feattle::FeattleValue [−][src]
The base trait for types that can be used for feattles.
This lib already implements this trait for many base types from the std lib, but the user can make their own types compatible by providing their own logic.
For types that are string based, it suffices to implement the somewhat simpler
FeattleStringValue
trait.
Required methods
pub fn as_json(&self) -> Value
[src]
Convert the value to its JSON representation.
pub fn overview(&self) -> String
[src]
Return a short overview of the current value. This is meant to give an overall idea of the actual value. For example, it can choose to display only the first 3 items of a large list.
pub fn try_from_json(value: &Value) -> Result<Self, FromJsonError>
[src]
Parse from a JSON representation of the value, if possible.
pub fn serialized_format() -> SerializedFormat
[src]
Return a precise description of a feattle type. This will be consumed, for example, by the UI code to show an appropriate HTML form in the admin panel.
Implementations on Foreign Types
impl FeattleValue for f32
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<f32, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for i8
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<i8, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for u16
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<u16, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for f64
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<f64, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl<T> FeattleValue for Vec<T, Global> where
T: FeattleValue,
[src]
T: FeattleValue,
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<Vec<T, Global>, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for u32
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<u32, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl<T> FeattleValue for Option<T> where
T: FeattleValue,
[src]
T: FeattleValue,
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<Option<T>, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for i32
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<i32, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for i64
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<i64, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl<T> FeattleValue for BTreeSet<T> where
T: FeattleValue + Ord,
[src]
T: FeattleValue + Ord,
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<BTreeSet<T>, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for usize
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<usize, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl<K, V> FeattleValue for BTreeMap<K, V> where
K: FeattleStringValue + Ord,
V: FeattleValue,
<K as FromStr>::Err: Error,
<K as FromStr>::Err: Send,
<K as FromStr>::Err: Sync,
<K as FromStr>::Err: 'static,
[src]
K: FeattleStringValue + Ord,
V: FeattleValue,
<K as FromStr>::Err: Error,
<K as FromStr>::Err: Send,
<K as FromStr>::Err: Sync,
<K as FromStr>::Err: 'static,
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<BTreeMap<K, V>, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for isize
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<isize, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for u64
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<u64, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for bool
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<bool, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for u8
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<u8, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
impl FeattleValue for i16
[src]
pub fn as_json(&self) -> Value
[src]
pub fn overview(&self) -> String
[src]
pub fn try_from_json(value: &Value) -> Result<i16, FromJsonError>
[src]
pub fn serialized_format() -> SerializedFormat
[src]
Implementors
impl<T> FeattleValue for T where
T: FeattleStringValue,
<T as FromStr>::Err: Error,
<T as FromStr>::Err: Send,
<T as FromStr>::Err: Sync,
<T as FromStr>::Err: 'static,
[src]
T: FeattleStringValue,
<T as FromStr>::Err: Error,
<T as FromStr>::Err: Send,
<T as FromStr>::Err: Sync,
<T as FromStr>::Err: 'static,