Module std::preludeExperimental [-]  [+] [src]

The Rust prelude

Because std is required by most serious Rust software, it is imported at the topmost level of every crate by default, as if the first line of each crate was

fn main() { extern crate std; }
extern crate std;

This means that the contents of std can be accessed from any context with the std:: path prefix, as in use std::vec, use std::task::spawn, etc.

Additionally, std contains a prelude module that reexports many of the most common traits, types and functions. The contents of the prelude are imported into every module by default. Implicitly, all modules behave as if they contained the following prologue:

fn main() { use std::prelude::*; }
use std::prelude::*;

The prelude is primarily concerned with exporting traits that are so pervasive that it would be obnoxious to import for every use, particularly those that define methods on primitive types. It does include a few particularly useful standalone functions, like from_str, range, and drop, spawn, and channel.

Reexports

pub use kinds::{Copy, Send, Sized, Sync};
pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
pub use ops::{BitAnd, BitOr, BitXor};
pub use ops::{Drop, Deref, DerefMut};
pub use ops::{Shl, Shr};
pub use ops::{Index, IndexMut};
pub use ops::{Slice, SliceMut};
pub use ops::{Fn, FnMut, FnOnce};
pub use iter::range;
pub use mem::drop;
pub use str::from_str;
pub use borrow::IntoCow;
pub use c_str::ToCStr;
pub use char::{Char, UnicodeChar};
pub use clone::Clone;
pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
pub use cmp::{Ordering, Equiv};
pub use cmp::Ordering::{Less, Equal, Greater};
pub use iter::{FromIterator, Extend, ExactSizeIterator};
pub use iter::{Iterator, IteratorExt, DoubleEndedIterator};
pub use iter::{DoubleEndedIteratorExt, CloneIteratorExt};
pub use iter::{RandomAccessIterator, IteratorCloneExt, IteratorPairExt};
pub use iter::{IteratorOrdExt, MutableDoubleEndedIterator};
pub use num::{ToPrimitive, FromPrimitive};
pub use boxed::Box;
pub use option::Option;
pub use option::Option::{Some, None};
pub use path::{GenericPath, Path, PosixPath, WindowsPath};
pub use ptr::{PtrExt, MutPtrExt};
pub use result::Result;
pub use result::Result::{Ok, Err};
pub use io::{Buffer, Writer, Reader, Seek, BufferPrelude};
pub use core::prelude::{Tuple1, Tuple2, Tuple3, Tuple4};
pub use core::prelude::{Tuple5, Tuple6, Tuple7, Tuple8};
pub use core::prelude::{Tuple9, Tuple10, Tuple11, Tuple12};
pub use str::{Str, StrExt};
pub use slice::AsSlice;
pub use slice::{SliceConcatExt, PartialEqSliceExt};
pub use slice::{CloneSliceExt, OrdSliceExt, SliceExt};
pub use slice::{BoxedSliceExt};
pub use string::{IntoString, String, ToString};
pub use vec::Vec;
pub use comm::{sync_channel, channel};
pub use comm::{SyncSender, Sender, Receiver};
pub use task::spawn;