Add fj::Result

This commit is contained in:
Hanno Braun 2023-06-06 11:18:06 +02:00
parent aab2de7640
commit 9da5b5e2d8
3 changed files with 6 additions and 3 deletions

View File

@ -15,7 +15,7 @@ use crate::Args;
pub fn handle_model<Model>( pub fn handle_model<Model>(
model: impl Deref<Target = Model>, model: impl Deref<Target = Model>,
tolerance: impl Into<Tolerance>, tolerance: impl Into<Tolerance>,
) -> Result<(), Error> ) -> Result
where where
for<'r> (&'r Model, Tolerance): Triangulate, for<'r> (&'r Model, Tolerance): Triangulate,
{ {
@ -31,6 +31,9 @@ where
Ok(()) Ok(())
} }
/// Return value of [`handle_model`]
pub type Result = std::result::Result<(), Error>;
/// Error returned by [`handle_model`] /// Error returned by [`handle_model`]
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum Error { pub enum Error {

View File

@ -16,7 +16,7 @@ mod handle_model;
pub use self::{ pub use self::{
args::Args, args::Args,
handle_model::{handle_model, Error}, handle_model::{handle_model, Error, Result},
}; };
pub use fj_core as core; pub use fj_core as core;

View File

@ -1,6 +1,6 @@
use fj::handle_model; use fj::handle_model;
fn main() -> Result<(), fj::Error> { fn main() -> fj::Result {
let cuboid = cuboid::cuboid(3., 2., 1.); let cuboid = cuboid::cuboid(3., 2., 1.);
// The tolerance makes no difference for this model, as there aren't any // The tolerance makes no difference for this model, as there aren't any