pub struct Field {
pub api_name: String,
pub rust_name: String,
pub typ: String,
pub source: Option<Source>,
}Fields§
§api_name: String§rust_name: String§typ: String§source: Option<Source>The source file of the compound type, parsed from the markdown link.
None for primitive types and same-file anchor links (#anchor).
Implementations§
Source§impl Field
impl Field
pub fn from_api_name(api_name: String, typ: String) -> Self
pub fn is_optional(&self) -> bool
pub fn is_vec(&self) -> bool
pub fn is_map(&self) -> bool
pub fn is_numeric(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_compound(&self) -> bool
Sourcepub fn inner_type(&self) -> Option<&str>
pub fn inner_type(&self) -> Option<&str>
Retrieves the inner type of Option<> or Vec<>
Retrieves the value type of BTreeMap<Key, Value>
Returns None if the field type is not Option, Vec or BTreeMap.
Sourcepub fn inner_type_offset(&self) -> Option<usize>
pub fn inner_type_offset(&self) -> Option<usize>
Like inner_type but returns an offset to the inner type in cthe original type string
Sourcepub fn base_type(&self) -> &str
pub fn base_type(&self) -> &str
Returns a base type(a type with all container types unwrapped)
E.g.
Message -> Message
Option<Message> -> Message
BTreeMap<i64, Option<Vec<Message>>> -> Message
Sourcepub fn base_type_offset(&self) -> usize
pub fn base_type_offset(&self) -> usize
Like a [base_type] but returns an offset to the base type in the original type string
Trait Implementations§
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more