pub fn blob(layout: Layout) -> quote::Tokens {
    let opaque = layout.opaque();

    // FIXME(emilio, #412): We fall back to byte alignment, but there are
    // some things that legitimately are more than 8-byte aligned.
    //
    // Eventually we should be able to `unwrap` here, but...
    let ty_name = match opaque.known_rust_type_for_array() {
        Some(ty) => ty,
        None => {
            warn!("Found unknown alignment on code generation!");
            "u8"
        }
    };

    let ty_name = quote::Ident::new(ty_name);

    let data_len = opaque.array_size().unwrap_or(layout.size);

    if data_len == 1 {
        quote! {
            #ty_name
        }
    } else {
        quote! {
            [ #ty_name ; #data_len ]
        }
    }
}
/// Generates a proper type for a field or type with a given `Layout`, that is,
/// a type with the correct size and alignment restrictions.
Generates a proper type for a field or type with a given `Layout`, that is,
a type with the correct size and alignment restrictions.
Generates a proper type for a field or type with a given ` Layout ` that is a type with the correct size and alignment restrictions .
pub fn blob(layout: Layout) -> quote::Tokens {
    let opaque = layout.opaque();
    // FIXME(emilio, #412): We fall back to byte alignment, but there are
    // some things that legitimately are more than 8-byte aligned.
    //
    // Eventually we should be able to `unwrap` here, but...
    let ty_name = match opaque.known_rust_type_for_array() {
        Some(ty) => ty,
        None => {
            warn!("Found unknown alignment on code generation!");
            "u8"
        }
    };
    let ty_name = quote::Ident::new(ty_name);
    let data_len = opaque.array_size().unwrap_or(layout.size);
    if data_len == 1 {
        quote! {
            #ty_name
        }
    } else {
        quote! {
            [ #ty_name ; #data_len ]
        }
    }
}
pub fn blob ( layout : Layout ) -> quote :: Tokens { let opaque = layout . opaque ( ) ; // FIXME(emilio, #412): We fall back to byte alignment, but there are // some things that legitimately are more than 8-byte aligned. // // Eventually we should be able to `unwrap` here, but... let ty_name = match opaque . known_rust_type_for_array ( ) { Some ( ty ) => ty , None => { warn ! ( " " ) ; " " } } ; let ty_name = quote :: Ident :: new ( ty_name ) ; let data_len = opaque . array_size ( ) . unwrap_or ( layout . size ) ; if data_len == 1 { quote ! { ty_name } } else { quote ! { [ ty_name data_len ] } } }
Generates a proper type for a field or type with a given `Layout`, that is,
a type with the correct size and alignment restrictions.
Generates a proper type for a field or type with a given ` Layout ` that is a type with the correct size and alignment restrictions .
layout
Layout
layout
Layout