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<'a, S: Encoder> Encodable<S> for Cow<'a, str>

source§

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

source§

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

source§

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

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 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 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§