Struct warpgrapher::engine::config::Property [−][src]
pub struct Property { /* fields omitted */ }
Configuration item for a property on a GraphQL type, modeled as properties on a graph node.
Examples
let p = Property::new("name".to_string(), false, "String".to_string(), true, false, None, None);
Implementations
impl Property
[src]
impl Property
[src]pub fn new(
name: String,
hidden: bool,
type_name: String,
required: bool,
list: bool,
resolver: Option<String>,
validator: Option<String>
) -> Property
[src]
pub fn new(
name: String,
hidden: bool,
type_name: String,
required: bool,
list: bool,
resolver: Option<String>,
validator: Option<String>
) -> Property
[src]Creates a new Property struct.
Arguments
- a String for the name of the property
- a String for the type of the property
- a boolean that, if true, indicatees that the property is mandatory, and if false, that the property is optional
- a boolean that, if true, indicates that the property is a list of scalers, and if false, that the property is a single value
- an optional string providing the name of a resolver, if the property is a dynamic property with a custom resolver, and
- an optional string providing the name of a custom validator
Examples
let p = Property::new("name".to_string(), false, "String".to_string(), true, false, None, None);
pub fn list(&self) -> bool
[src]
pub fn list(&self) -> bool
[src]Returns a boolean that if true, indicates that this property contains a list of scalar values, and if false, indicates that the property contains only one value (or potentially zero values if required is also false).
Examples
use warpgrapher::engine::config::Property;
let p = Property::new(“name”.to_string(), “String”.to_string(), true, false, None, None);
assert!(!p.list());
pub fn name(&self) -> &str
[src]
pub fn name(&self) -> &str
[src]Returns the name of the property
Examples
use warpgrapher::engine::config::Property;
let p = Property::new(“propname”.to_string(), “String”.to_string(), true, false, None, None);
assert_eq!(“propname”, p.name());
pub fn hidden(&self) -> bool
[src]
pub fn resolver(&self) -> Option<&String>
[src]
pub fn resolver(&self) -> Option<&String>
[src]Returns the optional name of the custom resolver associated with this property
Examples
use warpgrapher::engine::config::Property;
let p = Property::new(“propname”.to_string(), “String”.to_string(), true, false, Some(“CustomResolver”.to_string()), None);
assert_eq!(“CustomResolver”, p.resolver().unwrap());
pub fn required(&self) -> bool
[src]
pub fn required(&self) -> bool
[src]Returns a boolean that if true, indicates that this property is mandatory, and if false, that the property is not required, and may be absent.
Examples
use warpgrapher::engine::config::Property;
let p = Property::new(“name”.to_string(), “String”.to_string(), true, false, None, None);
assert!(p.required());
pub fn type_name(&self) -> &str
[src]
pub fn type_name(&self) -> &str
[src]Returns the name of the type of the property
Examples
use warpgrapher::engine::config::Property;
let p = Property::new(“propname”.to_string(), “String”.to_string(), true, false, None, None);
assert_eq!(“String”, p.type_name());
pub fn validator(&self) -> Option<&String>
[src]
pub fn validator(&self) -> Option<&String>
[src]Returns the optional name of the custom validator associated with this property
Examples
use warpgrapher::engine::config::Property;
let p = Property::new(“propname”.to_string(), “String”.to_string(), true, false, None, Some(“CustomValidator”.to_string()));
assert_eq!(“CustomValidator”, p.validator().unwrap());
Trait Implementations
impl<'de> Deserialize<'de> for Property
[src]
impl<'de> Deserialize<'de> for Property
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl Ord for Property
[src]
impl Ord for Property
[src]impl PartialOrd<Property> for Property
[src]
impl PartialOrd<Property> for Property
[src]fn partial_cmp(&self, other: &Property) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Property) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Property
[src]
impl StructuralEq for Property
[src]
impl StructuralPartialEq for Property
[src]
Auto Trait Implementations
impl RefUnwindSafe for Property
impl Send for Property
impl Sync for Property
impl Unpin for Property
impl UnwindSafe for Property
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,