Commit e6cb4a37 authored by Mark Hammond's avatar Mark Hammond
Browse files

Remove Type::External entirely.

parent df514fd1
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -50,9 +50,8 @@ or use UDL with types from more than one crate.

- Added the `FfiType::MutReference` variant.

- `Type::Custom` is no longer turned in to a `Type::External` for the bindings. Binding authors
  must check the type is local themselves before deciding to treat it as a local or external type.
  We expect `Type::External` will be removed soon and all types will be treated in this way.
- `Type::External` has been removed. Binding authors must now check the type is local themselves before
   deciding to treat it as a local or external type.

[All changes in [[UnreleasedUniFFIVersion]]](https://github.com/mozilla/uniffi-rs/compare/v0.28.3...HEAD).

+0 −27
Original line number Diff line number Diff line
/* 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 super::CodeType;
use crate::ComponentInterface;

#[derive(Debug)]
pub struct ExternalCodeType {
    name: String,
}

impl ExternalCodeType {
    pub fn new(name: String) -> Self {
        Self { name }
    }
}

impl CodeType for ExternalCodeType {
    fn type_label(&self, ci: &ComponentInterface) -> String {
        super::KotlinCodeOracle.class_name(ci, &self.name)
    }

    fn canonical_name(&self) -> String {
        format!("Type{}", self.name)
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ mod callback_interface;
mod compounds;
mod custom;
mod enum_;
mod external;
mod miscellany;
mod object;
mod primitives;
@@ -572,7 +571,6 @@ impl<T: AsType> AsCodeType for T {
                key_type,
                value_type,
            } => Box::new(compounds::MapCodeType::new(*key_type, *value_type)),
            Type::External { name, .. } => Box::new(external::ExternalCodeType::new(name)),
            Type::Custom { name, .. } => Box::new(custom::CustomCodeType::new(name)),
        }
    }
+0 −26
Original line number Diff line number Diff line
/* 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 super::CodeType;

#[derive(Debug)]
pub struct ExternalCodeType {
    name: String,
}

impl ExternalCodeType {
    pub fn new(name: String) -> Self {
        Self { name }
    }
}

impl CodeType for ExternalCodeType {
    fn type_label(&self) -> String {
        super::PythonCodeOracle.class_name(&self.name)
    }

    fn canonical_name(&self) -> String {
        format!("Type{}", self.type_label())
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ mod callback_interface;
mod compounds;
mod custom;
mod enum_;
mod external;
mod miscellany;
mod object;
mod primitives;
@@ -565,7 +564,6 @@ impl<T: AsType> AsCodeType for T {
                key_type,
                value_type,
            } => Box::new(compounds::MapCodeType::new(*key_type, *value_type)),
            Type::External { name, .. } => Box::new(external::ExternalCodeType::new(name)),
            Type::Custom { name, .. } => Box::new(custom::CustomCodeType::new(name)),
        }
    }
Loading