Document sealed trait
This commit is contained in:
parent
f341315473
commit
ef180dc6e7
|
@ -23,12 +23,14 @@ use std::{fmt, io, mem, ptr, slice, str};
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use core::{fmt, mem, ptr, slice, str};
|
use core::{fmt, mem, ptr, slice, str};
|
||||||
|
|
||||||
|
/// Write integer to an `io::Write`.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn write<W: io::Write, V: Integer>(wr: W, value: V) -> io::Result<usize> {
|
pub fn write<W: io::Write, V: Integer>(wr: W, value: V) -> io::Result<usize> {
|
||||||
value.write(wr)
|
value.write(wr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Write integer to an `fmt::Write`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn fmt<W: fmt::Write, V: Integer>(wr: W, value: V) -> fmt::Result {
|
pub fn fmt<W: fmt::Write, V: Integer>(wr: W, value: V) -> fmt::Result {
|
||||||
value.fmt(wr)
|
value.fmt(wr)
|
||||||
|
@ -39,6 +41,9 @@ mod private {
|
||||||
pub trait Sealed {}
|
pub trait Sealed {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An integer that can be formatted by `itoa::write` and `itoa::fmt`.
|
||||||
|
///
|
||||||
|
/// This trait is sealed and cannot be implemented for types outside of itoa.
|
||||||
pub trait Integer: private::Sealed {
|
pub trait Integer: private::Sealed {
|
||||||
// Not public API.
|
// Not public API.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
Loading…
Reference in New Issue