pub struct DefaultValueParser<'a> {
link_resolver: &'a LinkResolver<'a>,
current_module: &'a str,
}Expand description
Parser for default values that identifies and links type references
Fields§
§link_resolver: &'a LinkResolver<'a>§current_module: &'a strImplementations§
Source§impl<'a> DefaultValueParser<'a>
impl<'a> DefaultValueParser<'a>
pub fn new(link_resolver: &'a LinkResolver<'a>, current_module: &'a str) -> Self
Sourcepub fn parse(&self, default_str: &str, type_info: &TypeInfo) -> DocDefaultValue
pub fn parse(&self, default_str: &str, type_info: &TypeInfo) -> DocDefaultValue
Parse a default value string and identify type references
Sourcefn strip_module_prefixes(&self, text: &str) -> String
fn strip_module_prefixes(&self, text: &str) -> String
Strip module prefixes like “_core.”, “typing.”, “builtins.” from the display text
Sourcefn try_parse_attribute_ref(
&self,
text: &str,
_type_info: &TypeInfo,
) -> Option<DocTypeRef>
fn try_parse_attribute_ref( &self, text: &str, _type_info: &TypeInfo, ) -> Option<DocTypeRef>
Try to parse an attribute reference like “C.C1”
Auto Trait Implementations§
impl<'a> Freeze for DefaultValueParser<'a>
impl<'a> RefUnwindSafe for DefaultValueParser<'a>
impl<'a> Send for DefaultValueParser<'a>
impl<'a> Sync for DefaultValueParser<'a>
impl<'a> Unpin for DefaultValueParser<'a>
impl<'a> UnwindSafe for DefaultValueParser<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more