Struct reproto_core::RpField
[−]
[src]
pub struct RpField {
pub required: bool,
pub safe_ident: Option<String>,
pub ident: String,
pub comment: Vec<String>,
pub ty: RpType,
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: RpType
field_as: Option<String>
Alias of field in JSON.
Methods
impl RpField[src]
pub fn new<S: AsRef<str>>(ident: S, ty: RpType) -> 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[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 display(&self) -> String[src]
Trait Implementations
impl Debug for RpField[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl Clone for RpField[src]
fn clone(&self) -> RpField[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 PartialEq for RpField[src]
fn eq(&self, __arg_0: &RpField) -> 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) -> bool[src]
This method tests for !=.