rustc_serialize::serialize

Trait Encodable

Source
pub trait Encodable<S: Encoder> {
    // Required method
    fn encode(&self, s: &mut S);
}
Expand description

Trait for types that can be serialized

This can be implemented using the Encodable, TyEncodable and MetadataEncodable macros.

  • Encodable should be used in crates that don’t depend on rustc_middle.
  • MetadataEncodable is used in rustc_metadata for types that contain rustc_metadata::rmeta::Lazy.
  • TyEncodable should be used for types that are only serialized in crate metadata or the incremental cache. This is most types in rustc_middle.

Required Methods§

Source

fn encode(&self, s: &mut S)

Implementations on Foreign Types§

Source§

impl Encodable<FileEncoder> for [u8]

Source§

fn encode(&self, e: &mut FileEncoder)

Source§

impl<E: Encoder, K, V, S> Encodable<E> for HashMap<K, V, S>
where K: Encodable<E> + Eq, V: Encodable<E>, S: BuildHasher,

Source§

fn encode(&self, e: &mut E)

Source§

impl<E: Encoder, K, V, S> Encodable<E> for IndexMap<K, V, S>
where K: Encodable<E> + Hash + Eq, V: Encodable<E>, S: BuildHasher,

Source§

fn encode(&self, e: &mut E)

Source§

impl<E: Encoder, T, S> Encodable<E> for HashSet<T, S>
where T: Encodable<E> + Eq, S: BuildHasher,

Source§

fn encode(&self, s: &mut E)

Source§

impl<E: Encoder, T, S> Encodable<E> for IndexSet<T, S>
where T: Encodable<E> + Hash + Eq, S: BuildHasher,

Source§

fn encode(&self, s: &mut E)

Source§

impl<E: Encoder, T: Encodable<E>> Encodable<E> for Rc<[T]>

Source§

fn encode(&self, s: &mut E)

Source§

impl<E: Encoder, T: Encodable<E>> Encodable<E> for Arc<[T]>

Source§

fn encode(&self, s: &mut E)

Source§

impl<S: Encoder> Encodable<S> for Cow<'_, str>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for bool

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for char

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for i8

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for i16

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for i32

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for i64

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for i128

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for isize

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for !

Source§

fn encode(&self, _s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for str

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for u8

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for u16

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for u32

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for u64

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for u128

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for ()

Source§

fn encode(&self, _s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for usize

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for String

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for NonZero<u32>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder> Encodable<S> for Path

Source§

fn encode(&self, e: &mut S)

Source§

impl<S: Encoder> Encodable<S> for PathBuf

Source§

fn encode(&self, e: &mut S)

Source§

impl<S: Encoder, A: Array<Item: Encodable<S>>> Encodable<S> for SmallVec<A>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, K, V> Encodable<S> for BTreeMap<K, V>
where K: Encodable<S> + PartialEq + Ord, V: Encodable<S>,

Source§

fn encode(&self, e: &mut S)

Source§

impl<S: Encoder, T0: Encodable<S>, T1: Encodable<S>, T2: Encodable<S>, T3: Encodable<S>, T4: Encodable<S>, T5: Encodable<S>, T6: Encodable<S>, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T1: Encodable<S>, T2: Encodable<S>> Encodable<S> for Result<T1, T2>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T1: Encodable<S>, T2: Encodable<S>, T3: Encodable<S>, T4: Encodable<S>, T5: Encodable<S>, T6: Encodable<S>, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T2: Encodable<S>, T3: Encodable<S>, T4: Encodable<S>, T5: Encodable<S>, T6: Encodable<S>, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T3: Encodable<S>, T4: Encodable<S>, T5: Encodable<S>, T6: Encodable<S>, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T4: Encodable<S>, T5: Encodable<S>, T6: Encodable<S>, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T4, T5, T6, T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T5: Encodable<S>, T6: Encodable<S>, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T5, T6, T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T6: Encodable<S>, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T6, T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T7: Encodable<S>, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T7, T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T8: Encodable<S>, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T8, T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T9: Encodable<S>, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T9, T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T10: Encodable<S>, T11: Encodable<S>> Encodable<S> for (T10, T11)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T11: Encodable<S>> Encodable<S> for (T11,)

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T> Encodable<S> for &T
where T: Encodable<S> + ?Sized,

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T> Encodable<S> for BTreeSet<T>
where T: Encodable<S> + PartialEq + Ord,

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T> Encodable<S> for PhantomData<T>

Source§

fn encode(&self, _s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S> + Copy> Encodable<S> for Cell<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'_, [T]>
where [T]: ToOwned<Owned = Vec<T>>,

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for Option<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for [T]

Source§

default fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for VecDeque<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for Rc<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for Arc<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for Vec<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for RefCell<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for ThinVec<T>

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: Encodable<S>, const N: usize> Encodable<S> for [T; N]

Source§

fn encode(&self, s: &mut S)

Source§

impl<S: Encoder, T: ?Sized + Encodable<S>> Encodable<S> for Box<T>

Source§

fn encode(&self, s: &mut S)

Implementors§