[−][src]Struct warpgrapher::engine::config::Property
Configuration item for a property on a GraphQL type, modeled as properties on a graph node.
Examples
let p = Property::new("name".to_string(), "String".to_string(), true, false, None, None);
Implementations
impl Property
[src]
pub fn new(
name: String,
type_name: String,
required: bool,
list: bool,
resolver: Option<String>,
validator: Option<String>
) -> Property
[src]
name: String,
type_name: String,
required: bool,
list: bool,
resolver: Option<String>,
validator: Option<String>
) -> Property
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(), "String".to_string(), true, false, None, None);
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]
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 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]
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]
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]
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 Clone for Property
[src]
impl Debug for Property
[src]
impl<'de> Deserialize<'de> for Property
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for Property
[src]
impl Hash for Property
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Property
[src]
fn cmp(&self, other: &Property) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Property> for Property
[src]
impl PartialOrd<Property> for Property
[src]
fn partial_cmp(&self, other: &Property) -> Option<Ordering>
[src]
fn lt(&self, other: &Property) -> bool
[src]
fn le(&self, other: &Property) -> bool
[src]
fn gt(&self, other: &Property) -> bool
[src]
fn ge(&self, other: &Property) -> bool
[src]
impl Serialize for Property
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,