mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Add documentation for name_value_literal_span methods
This commit is contained in:
parent
63816da5ed
commit
a2d1254e22
@ -180,6 +180,13 @@ impl Attribute {
|
||||
self.value_str().is_some()
|
||||
}
|
||||
|
||||
/// This is used in case you want the value span instead of the whole attribute. Example:
|
||||
///
|
||||
/// ```text
|
||||
/// #[doc(alias = "foo")]
|
||||
/// ```
|
||||
///
|
||||
/// In here, it'll return a span for `"foo"`.
|
||||
pub fn name_value_literal_span(&self) -> Option<Span> {
|
||||
match self.kind {
|
||||
AttrKind::Normal(ref item, _) => {
|
||||
@ -241,6 +248,13 @@ impl MetaItem {
|
||||
self.value_str().is_some()
|
||||
}
|
||||
|
||||
/// This is used in case you want the value span instead of the whole attribute. Example:
|
||||
///
|
||||
/// ```text
|
||||
/// #[doc(alias = "foo")]
|
||||
/// ```
|
||||
///
|
||||
/// In here, it'll return a span for `"foo"`.
|
||||
pub fn name_value_literal_span(&self) -> Option<Span> {
|
||||
Some(self.name_value_literal()?.span)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user