Skip to content

Commit

Permalink
Removed choice for object-format in create-exe and create-obj commands (
Browse files Browse the repository at this point in the history
#3636)

* Removed choice for object-format in create-exe and create-obj commands (and related tests)
* Removed create-obj testing for Symbol object type
* Small change to have intermediary variable instead of a big Some(_)
  • Loading branch information
ptitSeb authored Mar 2, 2023
1 parent c7c9c8c commit a0b530b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 290 deletions.
29 changes: 0 additions & 29 deletions lib/cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub use binfmt::*;
pub use compile::*;
#[cfg(any(feature = "static-artifact-create", feature = "wasmer-artifact-create"))]
pub use create_exe::*;
use serde::{Deserialize, Serialize};
#[cfg(feature = "wast")]
pub use wast::*;
pub use {
Expand All @@ -39,31 +38,3 @@ pub use {
};
#[cfg(feature = "static-artifact-create")]
pub use {create_obj::*, gen_c_header::*};

/// The kind of object format to emit.
#[derive(Debug, Copy, Clone, PartialEq, Eq, clap::Parser, Serialize, Deserialize)]
pub enum ObjectFormat {
/// Serialize the entire module into an object file.
Serialized,
/// Serialize only the module metadata into an object file and emit functions as symbols.
Symbols,
}

impl Default for ObjectFormat {
fn default() -> Self {
ObjectFormat::Symbols
}
}

#[cfg(any(feature = "static-artifact-create", feature = "wasmer-artifact-create"))]
impl std::str::FromStr for ObjectFormat {
type Err = &'static str;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"serialized" => Ok(Self::Serialized),
"symbols" => Ok(Self::Symbols),
_ => Err("must be one of two options: `serialized` or `symbols`."),
}
}
}
Loading

0 comments on commit a0b530b

Please sign in to comment.