/// assert_eq!(a.len(), 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn len(&self) -> usize {
+ pub fn len(&self) -> usize {
self.length
}
/// assert!(!a.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn is_empty(&self) -> bool {
+ pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
/// assert_eq!(v.len(), 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn len(&self) -> usize {
+ pub fn len(&self) -> usize {
self.map.len()
}
/// assert!(!v.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn is_empty(&self) -> bool {
+ pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
/// assert!(!v.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn is_empty(&self) -> bool {
+ pub fn is_empty(&self) -> bool {
self.tail == self.head
}
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn len(&self) -> usize {
+ pub fn len(&self) -> usize {
self.vec.len()
}
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn is_empty(&self) -> bool {
+ pub fn is_empty(&self) -> bool {
self.len() == 0
}
/// assert_eq!(1, error.valid_up_to());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn utf8_error(&self) -> Utf8Error {
+ pub fn utf8_error(&self) -> Utf8Error {
self.error
}
}
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn len(&self) -> usize {
+ pub fn len(&self) -> usize {
self.len
}
/// assert!(!v.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn is_empty(&self) -> bool {
+ pub fn is_empty(&self) -> bool {
self.len() == 0
}
/// The minimum size in bytes for a memory block of this layout.
#[stable(feature = "alloc_layout", since = "1.28.0")]
#[inline]
- pub const fn size(&self) -> usize { self.size_ }
+ pub fn size(&self) -> usize { self.size_ }
/// The minimum byte alignment for a memory block of this layout.
#[stable(feature = "alloc_layout", since = "1.28.0")]
impl DecodeUtf16Error {
/// Returns the unpaired surrogate which caused this error.
#[stable(feature = "decode_utf16", since = "1.9.0")]
- pub const fn unpaired_surrogate(&self) -> u16 {
+ pub fn unpaired_surrogate(&self) -> u16 {
self.code
}
}
#[doc(hidden)] #[inline]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
issue = "0")]
- pub const fn new_v1(pieces: &'a [&'a str],
+ pub fn new_v1(pieces: &'a [&'a str],
args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
Arguments {
pieces,
#[doc(hidden)] #[inline]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
issue = "0")]
- pub const fn new_v1_formatted(pieces: &'a [&'a str],
+ pub fn new_v1_formatted(pieces: &'a [&'a str],
args: &'a [ArgumentV1<'a>],
fmt: &'a [rt::v1::Argument]) -> Arguments<'a> {
Arguments {
/// assert_eq!(&format!("{:t>6}", Foo), "tttttt");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
- pub const fn fill(&self) -> char { self.fill }
+ pub fn fill(&self) -> char { self.fill }
/// Flag indicating what form of alignment was requested.
///
/// assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
- pub const fn width(&self) -> Option<usize> { self.width }
+ pub fn width(&self) -> Option<usize> { self.width }
/// Optionally specified precision for numeric types.
///
/// assert_eq!(&format!("{}", Foo(23.2)), "Foo(23.20)");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
- pub const fn precision(&self) -> Option<usize> { self.precision }
+ pub fn precision(&self) -> Option<usize> { self.precision }
/// Determines if the `+` flag was specified.
///
/// assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
- pub const fn sign_plus(&self) -> bool {
+ pub fn sign_plus(&self) -> bool {
self.flags & (1 << FlagV1::SignPlus as u32) != 0
}
/// assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
- pub const fn sign_minus(&self) -> bool {
+ pub fn sign_minus(&self) -> bool {
self.flags & (1 << FlagV1::SignMinus as u32) != 0
}
/// assert_eq!(&format!("{}", Foo(23)), "23");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
- pub const fn alternate(&self) -> bool {
+ pub fn alternate(&self) -> bool {
self.flags & (1 << FlagV1::Alternate as u32) != 0
}
/// assert_eq!(&format!("{:04}", Foo(23)), "23");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
- pub const fn sign_aware_zero_pad(&self) -> bool {
+ pub fn sign_aware_zero_pad(&self) -> bool {
self.flags & (1 << FlagV1::SignAwareZeroPad as u32) != 0
}
issue = "0")]
#[doc(hidden)]
#[inline]
- pub const fn internal_constructor(message: Option<&'a fmt::Arguments<'a>>,
+ pub fn internal_constructor(message: Option<&'a fmt::Arguments<'a>>,
location: Location<'a>)
-> Self {
struct NoPayload;
///
/// [`fmt::write`]: ../fmt/fn.write.html
#[unstable(feature = "panic_info_message", issue = "44489")]
- pub const fn message(&self) -> Option<&fmt::Arguments> {
+ pub fn message(&self) -> Option<&fmt::Arguments> {
self.message
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
- pub const fn location(&self) -> Option<&Location> {
+ pub fn location(&self) -> Option<&Location> {
// NOTE: If this is changed to sometimes return None,
// deal with that case in std::panicking::default_hook and std::panicking::begin_panic_fmt.
Some(&self.location)
and related macros",
issue = "0")]
#[doc(hidden)]
- pub const fn internal_constructor(file: &'a str, line: u32, col: u32) -> Self {
+ pub fn internal_constructor(file: &'a str, line: u32, col: u32) -> Self {
Location { file, line, col }
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
- pub const fn file(&self) -> &str {
+ pub fn file(&self) -> &str {
self.file
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
- pub const fn line(&self) -> u32 {
+ pub fn line(&self) -> u32 {
self.line
}
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_col", since = "1.25.0")]
- pub const fn column(&self) -> u32 {
+ pub fn column(&self) -> u32 {
self.col
}
}
/// with the same lifetime as the original `Pin`.
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
- pub const fn get_ref(this: Pin<&'a T>) -> &'a T {
+ pub fn get_ref(this: Pin<&'a T>) -> &'a T {
this.pointer
}
}
/// Convert this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
- pub const fn into_ref(this: Pin<&'a mut T>) -> Pin<&'a T> {
+ pub fn into_ref(this: Pin<&'a mut T>) -> Pin<&'a T> {
Pin { pointer: this.pointer }
}
/// returned by the iterator. The returned slice has at most `chunk_size-1`
/// elements.
#[stable(feature = "chunks_exact", since = "1.31.0")]
- pub const fn remainder(&self) -> &'a [T] {
+ pub fn remainder(&self) -> &'a [T] {
self.rem
}
}
/// returned by the iterator. The returned slice has at most `chunk_size-1`
/// elements.
#[stable(feature = "rchunks", since = "1.31.0")]
- pub const fn remainder(&self) -> &'a [T] {
+ pub fn remainder(&self) -> &'a [T] {
self.rem
}
}
unsafe { mem::transmute(bytes) }
}
- pub const fn chunks(&self) -> Utf8LossyChunksIter {
+ pub fn chunks(&self) -> Utf8LossyChunksIter {
Utf8LossyChunksIter { source: &self.bytes }
}
}
/// assert_eq!(1, error.valid_up_to());
/// ```
#[stable(feature = "utf8_error", since = "1.5.0")]
- pub const fn valid_up_to(&self) -> usize { self.valid_up_to }
+ pub fn valid_up_to(&self) -> usize { self.valid_up_to }
/// Provide more information about the failure:
///
/// `Waker` is nearly identical to `LocalWaker`, but is threadsafe
/// (implements `Send` and `Sync`).
#[inline]
- pub const fn as_waker(&self) -> &Waker {
+ pub fn as_waker(&self) -> &Waker {
&self.0
}
/// assert_eq!(map.entry("poneyland").key(), &"poneyland");
/// ```
#[stable(feature = "map_entry_keys", since = "1.10.0")]
- pub const fn key(&self) -> &K {
+ pub fn key(&self) -> &K {
&self.key
}
/// assert_eq!(nul_error.nul_position(), 7);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn nul_position(&self) -> usize { self.0 }
+ pub fn nul_position(&self) -> usize { self.0 }
/// Consumes this error, returning the underlying vector of bytes which
/// generated the error in the first place.
/// Access the underlying UTF-8 error that was the cause of this error.
#[stable(feature = "cstring_into", since = "1.7.0")]
- pub const fn utf8_error(&self) -> Utf8Error {
+ pub fn utf8_error(&self) -> Utf8Error {
self.error
}
}
/// };
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn error(&self) -> &Error { &self.1 }
+ pub fn error(&self) -> &Error { &self.1 }
/// Returns the buffered writer instance which generated the error.
///
/// }
/// ```
#[stable(feature = "more_io_inner_methods", since = "1.20.0")]
- pub const fn get_ref(&self) -> (&T, &U) {
+ pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second)
}
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn limit(&self) -> u64 { self.limit }
+ pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will
/// return EOF. This is the same as constructing a new `Take` instance, so
/// }
/// ```
#[stable(feature = "more_io_inner_methods", since = "1.20.0")]
- pub const fn get_ref(&self) -> &T {
+ pub fn get_ref(&self) -> &T {
&self.inner
}
/// assert_eq!(socket.flowinfo(), 10);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn flowinfo(&self) -> u32 {
+ pub fn flowinfo(&self) -> u32 {
self.inner.sin6_flowinfo
}
/// assert_eq!(socket.scope_id(), 78);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn scope_id(&self) -> u32 {
+ pub fn scope_id(&self) -> u32 {
self.inner.sin6_scope_id
}
/// assert_eq!(addr.octets(), [127, 0, 0, 1]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn octets(&self) -> [u8; 4] {
+ pub fn octets(&self) -> [u8; 4] {
let bits = u32::from_be(self.inner.s_addr);
[(bits >> 24) as u8, (bits >> 16) as u8, (bits >> 8) as u8, bits as u8]
}
///
/// [`Prefix`]: enum.Prefix.html
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn kind(&self) -> Prefix<'a> {
+ pub fn kind(&self) -> Prefix<'a> {
self.parsed
}
///
/// [`OsStr`]: ../../std/ffi/struct.OsStr.html
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn as_os_str(&self) -> &'a OsStr {
+ pub fn as_os_str(&self) -> &'a OsStr {
self.raw
}
}
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`parent`]: struct.Path.html#method.parent
#[stable(feature = "path_ancestors", since = "1.28.0")]
- pub const fn ancestors(&self) -> Ancestors {
+ pub fn ancestors(&self) -> Ancestors {
Ancestors {
next: Some(&self),
}
/// println!("{}", path.display());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn display(&self) -> Display {
+ pub fn display(&self) -> Display {
Display { path: self }
}
/// }
/// ```
#[stable(feature = "wait_timeout", since = "1.5.0")]
- pub const fn timed_out(&self) -> bool {
+ pub fn timed_out(&self) -> bool {
self.0
}
}
/// assert_eq!(iter.next(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn iter(&self) -> Iter<T> {
+ pub fn iter(&self) -> Iter<T> {
Iter { rx: self }
}
/// assert_eq!(iter.next(), None);
/// ```
#[stable(feature = "receiver_try_iter", since = "1.15.0")]
- pub const fn try_iter(&self) -> TryIter<T> {
+ pub fn try_iter(&self) -> TryIter<T> {
TryIter { rx: self }
}
/// assert!(!state.poisoned());
/// });
#[unstable(feature = "once_poison", issue = "33577")]
- pub const fn poisoned(&self) -> bool {
+ pub fn poisoned(&self) -> bool {
self.poisoned
}
}
/// println!("thread id: {:?}", thread.id());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn thread(&self) -> &Thread {
+ pub fn thread(&self) -> &Thread {
&self.0.thread
}
/// }
/// ```
#[stable(feature = "time2", since = "1.8.0")]
- pub const fn duration(&self) -> Duration {
+ pub fn duration(&self) -> Duration {
self.0
}
}