Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed choice for object-format in create-exe and create-obj commands #3636

Merged
merged 5 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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