summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uniffi-example-geometry
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/uniffi-example-geometry')
-rw-r--r--third_party/rust/uniffi-example-geometry/.cargo-checksum.json1
-rw-r--r--third_party/rust/uniffi-example-geometry/Cargo.toml39
-rw-r--r--third_party/rust/uniffi-example-geometry/build.rs7
-rw-r--r--third_party/rust/uniffi-example-geometry/src/geometry.udl15
-rw-r--r--third_party/rust/uniffi-example-geometry/src/lib.rs47
-rw-r--r--third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.kts10
-rw-r--r--third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.py10
-rw-r--r--third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.rb16
-rw-r--r--third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.swift10
-rw-r--r--third_party/rust/uniffi-example-geometry/tests/test_generated_bindings.rs6
10 files changed, 0 insertions, 161 deletions
diff --git a/third_party/rust/uniffi-example-geometry/.cargo-checksum.json b/third_party/rust/uniffi-example-geometry/.cargo-checksum.json
deleted file mode 100644
index 52b8ef33db..0000000000
--- a/third_party/rust/uniffi-example-geometry/.cargo-checksum.json
+++ /dev/null
@@ -1 +0,0 @@
-{"files":{"Cargo.toml":"2d2c1ec66f7e2aaa4553b5338e68a7b64d68b84152547e1ccc4eeb019ca97103","build.rs":"fc5da645c8862e15f3b6879db179a1e5eec6161dc1cfbf95a4db9daf107a133f","src/geometry.udl":"7da7a6ec080c7117ec3c25206e23f9ed436e60b1a26fba34f991547680443550","src/lib.rs":"f9d004c97efb1a719368169f0aab181f27439eda3520c1afaca2420433226682","tests/bindings/test_geometry.kts":"e537185e3c699df1c0468525700e8a38f9a504b2a663c38442146b951e38e9a7","tests/bindings/test_geometry.py":"600e74ba0eba4e35d824c8f6d5bd5a2120a470017e8465c32d1e954a1939d323","tests/bindings/test_geometry.rb":"651de70af595f8b52ef030a03356939e8c1d0b40e44b4155b45d565d1d1dcbed","tests/bindings/test_geometry.swift":"a61fec6bfe16020809e20e4da372748c24366767138c5672a0bfff85c4b62d78","tests/test_generated_bindings.rs":"ff8fc093ccb6ee3ee2235c09276c7bb87234ad143667429cb721e46379577f3d"},"package":null} \ No newline at end of file
diff --git a/third_party/rust/uniffi-example-geometry/Cargo.toml b/third_party/rust/uniffi-example-geometry/Cargo.toml
deleted file mode 100644
index b9c8a0beb6..0000000000
--- a/third_party/rust/uniffi-example-geometry/Cargo.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
-#
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
-
-[package]
-edition = "2021"
-name = "uniffi-example-geometry"
-version = "0.22.0"
-authors = ["Firefox Sync Team <sync-team@mozilla.com>"]
-publish = false
-license = "MPL-2.0"
-
-[lib]
-name = "uniffi_geometry"
-crate-type = [
- "lib",
- "cdylib",
-]
-
-[dependencies.uniffi]
-version = "0.27"
-path = "../../uniffi"
-
-[dev-dependencies.uniffi]
-version = "0.27"
-path = "../../uniffi"
-features = ["bindgen-tests"]
-
-[build-dependencies.uniffi]
-version = "0.27"
-path = "../../uniffi"
-features = ["build"]
diff --git a/third_party/rust/uniffi-example-geometry/build.rs b/third_party/rust/uniffi-example-geometry/build.rs
deleted file mode 100644
index 2dd1c96bc3..0000000000
--- a/third_party/rust/uniffi-example-geometry/build.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-/* 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/. */
-
-fn main() {
- uniffi::generate_scaffolding("src/geometry.udl").unwrap();
-}
diff --git a/third_party/rust/uniffi-example-geometry/src/geometry.udl b/third_party/rust/uniffi-example-geometry/src/geometry.udl
deleted file mode 100644
index af60d429bf..0000000000
--- a/third_party/rust/uniffi-example-geometry/src/geometry.udl
+++ /dev/null
@@ -1,15 +0,0 @@
-
-namespace geometry {
- double gradient(Line ln);
- Point? intersection(Line ln1, Line ln2);
-};
-
-dictionary Point {
- double coord_x;
- double coord_y;
-};
-
-dictionary Line {
- Point start;
- Point end;
-};
diff --git a/third_party/rust/uniffi-example-geometry/src/lib.rs b/third_party/rust/uniffi-example-geometry/src/lib.rs
deleted file mode 100644
index d710b150bb..0000000000
--- a/third_party/rust/uniffi-example-geometry/src/lib.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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/. */
-
-// https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
-// Silence, clippy!
-const EPSILON: f64 = 0.0001f64;
-
-#[derive(Debug, Clone)]
-pub struct Point {
- coord_x: f64,
- coord_y: f64,
-}
-
-#[derive(Debug, Clone)]
-pub struct Line {
- start: Point,
- end: Point,
-}
-
-pub fn gradient(ln: Line) -> f64 {
- let rise = ln.end.coord_y - ln.start.coord_y;
- let run = ln.end.coord_x - ln.start.coord_x;
- rise / run
-}
-
-pub fn intersection(ln1: Line, ln2: Line) -> Option<Point> {
- // TODO: yuck, should be able to take &Line as argument here
- // and have rust figure it out with a bunch of annotations...
- let g1 = gradient(ln1.clone());
- let z1 = ln1.start.coord_y - g1 * ln1.start.coord_x;
- let g2 = gradient(ln2.clone());
- let z2 = ln2.start.coord_y - g2 * ln2.start.coord_x;
- // Parallel lines do not intersect.
- if (g1 - g2).abs() < EPSILON {
- return None;
- }
- // Otherwise, they intersect at this fancy calculation that
- // I found on wikipedia.
- let x = (z2 - z1) / (g1 - g2);
- Some(Point {
- coord_x: x,
- coord_y: g1 * x + z1,
- })
-}
-
-uniffi::include_scaffolding!("geometry");
diff --git a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.kts b/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.kts
deleted file mode 100644
index 77bb9932ec..0000000000
--- a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.kts
+++ /dev/null
@@ -1,10 +0,0 @@
-import uniffi.geometry.*;
-
-val ln1 = Line(Point(0.0,0.0), Point(1.0,2.0))
-val ln2 = Line(Point(1.0,1.0), Point(2.0,2.0))
-
-assert( gradient(ln1) == 2.0 )
-assert( gradient(ln2) == 1.0 )
-
-assert( intersection(ln1, ln2) == Point(0.0, 0.0) )
-assert( intersection(ln1, ln1) == null )
diff --git a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.py b/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.py
deleted file mode 100644
index fd6772be24..0000000000
--- a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from geometry import *
-
-ln1 = Line(start=Point(coord_x=0, coord_y=0), end=Point(coord_x=1, coord_y=2))
-ln2 = Line(start=Point(coord_x=1, coord_y=1), end=Point(coord_x=2, coord_y=2))
-
-assert gradient(ln1) == 2
-assert gradient(ln2) == 1
-
-assert intersection(ln1, ln2) == Point(coord_x=0, coord_y=0)
-assert intersection(ln1, ln1) is None
diff --git a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.rb b/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.rb
deleted file mode 100644
index 90fdff684e..0000000000
--- a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-require 'test/unit'
-require 'geometry'
-
-include Test::Unit::Assertions
-include Geometry
-
-ln1 = Line.new(start: Point.new(coord_x: 0.0, coord_y: 0.0), _end: Point.new(coord_x: 1.0, coord_y: 2.0))
-ln2 = Line.new(start: Point.new(coord_x: 1.0, coord_y: 1.0), _end: Point.new(coord_x: 2.0, coord_y: 2.0))
-
-assert_equal Geometry.gradient(ln1), 2
-assert_equal Geometry.gradient(ln2), 1
-
-assert_equal Geometry.intersection(ln1, ln2), Point.new(coord_x: 0, coord_y: 0)
-assert Geometry.intersection(ln1, ln1).nil?
diff --git a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.swift b/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.swift
deleted file mode 100644
index 58bd65607f..0000000000
--- a/third_party/rust/uniffi-example-geometry/tests/bindings/test_geometry.swift
+++ /dev/null
@@ -1,10 +0,0 @@
-import geometry
-
-let ln1 = Line(start: Point(coordX: 0, coordY: 0), end: Point(coordX: 1, coordY: 2))
-let ln2 = Line(start: Point(coordX: 1, coordY: 1), end: Point(coordX: 2, coordY: 2))
-
-assert(gradient(ln: ln1) == 2.0)
-assert(gradient(ln: ln2) == 1.0)
-
-assert(intersection(ln1: ln1, ln2: ln2) == Point(coordX: 0, coordY: 0))
-assert(intersection(ln1: ln1, ln2: ln1) == nil)
diff --git a/third_party/rust/uniffi-example-geometry/tests/test_generated_bindings.rs b/third_party/rust/uniffi-example-geometry/tests/test_generated_bindings.rs
deleted file mode 100644
index 4638d847c8..0000000000
--- a/third_party/rust/uniffi-example-geometry/tests/test_generated_bindings.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-uniffi::build_foreign_language_testcases!(
- "tests/bindings/test_geometry.py",
- "tests/bindings/test_geometry.rb",
- "tests/bindings/test_geometry.kts",
- "tests/bindings/test_geometry.swift",
-);