2012-12-10 15:44:02 -08:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-11-30 01:31:56 -08:00
|
|
|
/*!
|
2013-12-24 17:08:28 +01:00
|
|
|
Primitive traits representing basic 'kinds' of types
|
2012-11-30 00:47:45 -08:00
|
|
|
|
2012-11-30 15:39:44 -05:00
|
|
|
Rust types can be classified in various useful ways according to
|
2012-11-30 01:31:56 -08:00
|
|
|
intrinsic properties of the type. These classifications, often called
|
|
|
|
'kinds', are represented as traits.
|
|
|
|
|
|
|
|
They cannot be implemented by user code, but are instead implemented
|
|
|
|
by the compiler automatically for the types to which they apply.
|
|
|
|
|
|
|
|
*/
|
2012-11-30 00:47:45 -08:00
|
|
|
|
2013-08-13 20:46:50 -04:00
|
|
|
/// Types able to be transferred across task boundaries.
|
2013-06-05 11:33:14 -07:00
|
|
|
#[lang="send"]
|
2013-06-05 17:56:24 -07:00
|
|
|
pub trait Send {
|
2013-06-05 11:33:14 -07:00
|
|
|
// empty.
|
2012-11-30 00:47:45 -08:00
|
|
|
}
|
|
|
|
|
2013-08-13 20:46:50 -04:00
|
|
|
/// Types that are either immutable or have inherited mutability.
|
2013-06-05 14:52:27 -07:00
|
|
|
#[lang="freeze"]
|
2013-06-05 15:53:17 -07:00
|
|
|
pub trait Freeze {
|
2013-06-05 14:52:27 -07:00
|
|
|
// empty.
|
2012-11-30 01:31:56 -08:00
|
|
|
}
|
2013-05-30 20:03:01 -04:00
|
|
|
|
2013-08-13 20:46:50 -04:00
|
|
|
/// Types with a constant size known at compile-time.
|
2013-05-30 20:03:01 -04:00
|
|
|
#[lang="sized"]
|
|
|
|
pub trait Sized {
|
|
|
|
// Empty.
|
|
|
|
}
|
2013-12-11 12:40:51 -08:00
|
|
|
|
|
|
|
/// Types that can be copied by simply copying bits (i.e. `memcpy`).
|
|
|
|
///
|
|
|
|
/// The name "POD" stands for "Plain Old Data" and is borrowed from C++.
|
|
|
|
#[lang="pod"]
|
|
|
|
pub trait Pod {
|
|
|
|
// Empty.
|
|
|
|
}
|
|
|
|
|