Sha256: 22910bf0521ab868ebd7c62601c55912d12cfb400c65723e08e5cfa3a2d111c0

Contents?: true

Size: 390 Bytes

Versions: 33

Compression:

Stored size: 390 Bytes

Contents

use proc_macro2::TokenStream;
use quote::ToTokens;

pub(crate) struct TokensOrDefault<'a, T: 'a>(pub &'a Option<T>);

impl<'a, T> ToTokens for TokensOrDefault<'a, T>
where
    T: ToTokens + Default,
{
    fn to_tokens(&self, tokens: &mut TokenStream) {
        match self.0 {
            Some(t) => t.to_tokens(tokens),
            None => T::default().to_tokens(tokens),
        }
    }
}

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/syn-2.0.96/src/print.rs
wasmtime-28.0.0 ./ext/cargo-vendor/syn-2.0.95/src/print.rs
wasmtime-27.0.0 ./ext/cargo-vendor/syn-2.0.89/src/print.rs
wasmtime-26.0.0 ./ext/cargo-vendor/syn-2.0.85/src/print.rs
wasmtime-25.0.2 ./ext/cargo-vendor/syn-2.0.75/src/print.rs
wasmtime-25.0.1 ./ext/cargo-vendor/syn-2.0.75/src/print.rs
wasmtime-25.0.0 ./ext/cargo-vendor/syn-2.0.75/src/print.rs
wasmtime-24.0.0 ./ext/cargo-vendor/syn-2.0.75/src/print.rs
wasmtime-23.0.2 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-22.0.0 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-21.0.1 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-20.0.2 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-20.0.0 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-18.0.3 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-17.0.1 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-17.0.0 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-16.0.0 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-15.0.1 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-15.0.0 ./ext/cargo-vendor/syn-2.0.48/src/print.rs
wasmtime-14.0.4 ./ext/cargo-vendor/syn-2.0.38/src/print.rs