Struct reproto_core::RpField
[−]
[src]
pub struct RpField<F: 'static> where
F: Flavor, { pub required: bool, pub safe_ident: Option<String>, pub ident: String, pub comment: Vec<String>, pub ty: F::Type, pub field_as: Option<String>, }
Fields
required: bool
Is the field required.
safe_ident: Option<String>
Mangled identifier, taking target-specific keywords into account.
ident: String
Original identifier used to specify the field.
comment: Vec<String>
Field comments.
ty: F::Type
field_as: Option<String>
Alias of field in JSON.
Methods
impl<F: 'static> RpField<F> where
F: Flavor,
[src]
F: Flavor,
pub fn new<S: AsRef<str>>(ident: S, ty: F::Type) -> Self
[src]
pub fn is_optional(&self) -> bool
[src]
pub fn is_required(&self) -> bool
[src]
pub fn safe_ident(&self) -> &str
[src]
Get the keyword-safe identifier.
This will be the identifier escaped to avoid any target-language keywords.
pub fn with_safe_ident<S: AsRef<str>>(self, safe_ident: S) -> RpField<F>
[src]
Change the safe identifier.
pub fn ident(&self) -> &str
[src]
Get the original identifier of the field.
pub fn name(&self) -> &str
[src]
Get the JSON name of the field, if it differs from ident
.
TODO: Return Option
, currently returns ident. This is a better indication whether
'renaming' should occur.
pub fn ty(&self) -> &F::Type
[src]
Get the type of the field.
pub fn display(&self) -> String
[src]
Trait Implementations
impl<F: Debug + 'static> Debug for RpField<F> where
F: Flavor,
F::Type: Debug,
[src]
F: Flavor,
F::Type: Debug,
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<F: Clone + 'static> Clone for RpField<F> where
F: Flavor,
F::Type: Clone,
[src]
F: Flavor,
F::Type: Clone,
fn clone(&self) -> RpField<F>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<F: PartialEq + 'static> PartialEq for RpField<F> where
F: Flavor,
F::Type: PartialEq,
[src]
F: Flavor,
F::Type: PartialEq,
fn eq(&self, __arg_0: &RpField<F>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RpField<F>) -> bool
[src]
This method tests for !=
.
impl<F: Eq + 'static> Eq for RpField<F> where
F: Flavor,
F::Type: Eq,
[src]
F: Flavor,
F::Type: Eq,
impl<F: 'static> FlavorField for RpField<F> where
F: Flavor,
[src]
F: Flavor,
fn is_discriminating(&self) -> bool
[src]
Indicates if the field is discriminating in an untagged context.
impl<F: 'static, T> Translate<T> for RpField<F> where
F: Flavor,
T: Translator<Source = F>,
[src]
F: Flavor,
T: Translator<Source = F>,