Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  remote.rs

  Sprache: Rust
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


use proc_macro2::TokenStream;
use quote::quote;
use syn::{
    parse::{Parse, ParseStream},
    Ident, Token, Type,
};

pub struct RemoteTypeArgs {
    pub implementing_crate: Ident,
    pub sep: Token![::],
    pub ty: Type,
}

impl Parse for RemoteTypeArgs {
    fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
        Ok(Self {
            implementing_crate: input.parse()?,
            sep: input.parse()?,
            ty: input.parse()?,
        })
    }
}

pub fn expand_remote_type(args: RemoteTypeArgs) -> TokenStream {
    let RemoteTypeArgs {
        implementing_crate,
        ty,
        ..
    } = args;
    let existing_tag = quote! { #implementing_crate::UniFfiTag };

    quote! {
        unsafe impl ::uniffi::FfiConverter<crate::UniFfiTag> for #ty {
            type FfiType = <#ty as ::uniffi::FfiConverter<#existing_tag>>::FfiType;

            fn lower(obj: #ty) -> Self::FfiType {
                <#ty as ::uniffi::FfiConverter<#existing_tag>>::lower(obj)
            }

            fn try_lift(v: Self::FfiType) -> ::uniffi::Result<#ty> {
                <#ty as ::uniffi::FfiConverter<#existing_tag>>::try_lift(v)
            }

            fn write(obj: #ty, buf: &mut Vec<u8>) {
                <#ty as ::uniffi::FfiConverter<#existing_tag>>::write(obj, buf)
            }

            fn try_read(buf: &mut &[u8]) -> ::uniffi::Result<#ty> {
                <#ty as ::uniffi::FfiConverter<#existing_tag>>::try_read(buf)
            }

            const TYPE_ID_META: ::uniffi::MetadataBuffer =
                <#ty as ::uniffi::FfiConverter<#existing_tag>>::TYPE_ID_META;
        }

        ::uniffi::derive_ffi_traits!(local #ty);
    }
}

Messung V0.5 in Prozent
C=96 H=99 G=97

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-08-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=434850
#Domains=661743