Lines Matching refs:Span
315 pub fn span(&self) -> Span {
316 Span::_new(self.inner.span())
334 /// The source file of a given `Span`.
387 pub struct Span {
388 inner: imp::Span,
392 impl Span {
393 fn _new(inner: imp::Span) -> Self {
394 Span {
400 fn _new_fallback(inner: fallback::Span) -> Self {
401 Span {
413 Span::_new(imp::Span::call_site())
420 Span::_new(imp::Span::mixed_site())
429 Span::_new(imp::Span::def_site())
434 pub fn resolved_at(&self, other: Span) -> Span {
435 Span::_new(self.inner.resolved_at(other.inner))
440 pub fn located_at(&self, other: Span) -> Span {
441 Span::_new(self.inner.located_at(other.inner))
444 /// Convert `proc_macro2::Span` to `proc_macro::Span`.
452 /// `proc_macro2::Span`, the `proc_macro::Span` type can only exist within
455 pub fn unwrap(self) -> proc_macro::Span {
459 // Soft deprecated. Please use Span::unwrap.
462 pub fn unstable(self) -> proc_macro::Span {
509 /// Warning: the underlying [`proc_macro::Span::join`] method is
513 /// [`proc_macro::Span::join`]: https://doc.rust-lang.org/proc_macro/struct.Span.html#method.join
514 pub fn join(&self, other: Span) -> Option<Span> {
515 self.inner.join(other.inner).map(Span::_new)
523 pub fn eq(&self, other: &Span) -> bool {
540 impl Debug for Span {
562 pub fn span(&self) -> Span {
576 pub fn set_span(&mut self, span: Span) {
686 /// `Span::call_site()`. To change the span you can use the `set_span`
712 /// pub fn span(&self) -> Span {
715 pub fn span(&self) -> Span {
716 Span::_new(self.inner.span())
722 /// pub fn span_open(&self) -> Span {
725 pub fn span_open(&self) -> Span {
726 Span::_new(self.inner.span_open())
732 /// pub fn span_close(&self) -> Span {
735 pub fn span_close(&self) -> Span {
736 Span::_new(self.inner.span_close())
752 pub fn set_span(&mut self, span: Span) {
780 span: Span,
802 /// The returned `Punct` will have the default span of `Span::call_site()`
808 span: Span::call_site(),
827 pub fn span(&self) -> Span {
832 pub fn set_span(&mut self, span: Span) {
878 /// use proc_macro2::{Ident, Span};
881 /// let call_ident = Ident::new("calligraphy", Span::call_site());
890 /// use proc_macro2::{Ident, Span};
894 /// let ident = Ident::new("demo", Span::call_site());
900 /// let temp_ident = Ident::new(&format!("new_{}", ident), Span::call_site());
909 /// # use proc_macro2::{Ident, Span};
911 /// # let ident = Ident::new("another_identifier", Span::call_site());
942 /// As of this time `Span::call_site()` explicitly opts-in to "call-site"
947 /// Later spans like `Span::def_site()` will allow to opt-in to
953 /// tokens, requires a `Span` to be specified at construction.
965 pub fn new(string: &str, span: Span) -> Self {
975 pub fn new_raw(string: &str, span: Span) -> Self {
980 pub fn span(&self) -> Span {
981 Span::_new(self.inner.span())
986 pub fn set_span(&mut self, span: Span) {
1062 /// Literals created through this method have the `Span::call_site()`
1083 /// Literals created through this method have the `Span::call_site()`
1225 pub fn span(&self) -> Span {
1226 Span::_new(self.inner.span())
1230 pub fn set_span(&mut self, span: Span) {
1234 /// Returns a `Span` that is a subset of `self.span()` containing only
1243 pub fn subspan<R: RangeBounds<usize>>(&self, range: R) -> Option<Span> {
1244 self.inner.subspan(range).map(Span::_new)