text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>#include <iostream> #include <fstream> #include <cstdlib> #include <string> #include <cinttypes> #include "wasm.hh" // A function to be called from Wasm code. auto fail_callback( void* env, const wasm::vec<wasm::Val>& args, wasm::vec<wasm::Val>& results ) -> wasm::own<wasm::Trap> { std::cout << "Cal...
fim
wasmerio/wasmer
cpp
<|fim_suffix|>type_t* wasm_memorytype_as_externtype(wasm_memorytype_t*); WASM_API_EXTERN wasm_functype_t* wasm_externtype_as_functype(wasm_externtype_t*); WASM_API_EXTERN wasm_globaltype_t* wasm_externtype_as_globaltype(wasm_externtype_t*); WASM_API_EXTERN wasm_tabletype_t* wasm_externtype_as_tabletype(wasm_externtype...
fim
wasmerio/wasmer
c
<|fim_suffix|>Type*, const Value&) -> own<Global>; auto copy() const -> own<Global>; auto type() const -> own<GlobalType>; auto get() const -> Value; void set(const Value&); }; // Table Instances class WASM_API_EXTERN Table : public Extern { public: Table() = delete; ~Table(); using size_t = uint32_t...
fim
wasmerio/wasmer
cpp
<|fim_suffix|> = bin::section_end(binary, SEC_TABLE)); } return v; } // Memory section auto memories( const vec<byte_t>& binary, const ownvec<ImportType>& imports ) -> ownvec<MemoryType> { auto pos = bin::section(binary, SEC_MEMORY); size_t size = pos != nullptr ? bin::u32(pos) : 0; auto v = ownvec<Memor...
fim
wasmerio/wasmer
cpp
<|fim_suffix|>wnvec<ImportType>; auto exports(const vec<byte_t>& binary) -> ownvec<ExportType>; } // namespace bin } // namespace wasm #endif // #ifdef __WASM_BIN_HH <|fim_prefix|>#ifndef __WASM_BIN_HH #define __WASM_BIN_HH #include "wasm.hh" namespace wasm { namespace bin { auto u32_size(uint32_t) -> size_t; a...
fim
wasmerio/wasmer
cpp
<|fim_suffix|>odule_serialize(const wasm_module_t* module, wasm_byte_vec_t* out) { *out = release_byte_vec(reveal_module(module)->serialize()); } wasm_module_t* wasm_module_deserialize( wasm_store_t* store, const wasm_byte_vec_t* binary ) { auto binary_ = borrow_byte_vec(binary); return release_module(Module::...
fim
wasmerio/wasmer
cpp
<|fim_prefix|>#include "wasm-v8-lowlevel.hh" // TODO(v8): if we don't include these, api.h does not compile #include "objects/objects.h" #include "objects/bigint.h" #include "objects/managed.h" #include "objects/module.h" #include "objects/shared-function-info.h" #include "objects/templates.h" #include "objects/fixed-...
fim
wasmerio/wasmer
cpp
<|fim_prefix|>#ifndef __WASM_V8_LOWLEVEL_HH #define __WASM_V8_LOWLEVEL_HH #include "v8.h" namespace v8 { namespace wasm { auto object_isolate(v8::Local<v8::Object>) -> v8::Isolate*; auto object_isolate(const v8::Persistent<v8::Object>&) -> v8::Isolate*; auto object_is_module(v8::Local<v8::Object>) -> bool; auto obj...
fim
wasmerio/wasmer
cpp
<|fim_prefix|>#include "wasm.hh" #include "wasm-bin.hh" #include "wasm-v8-lowlevel.hh" #include "v8.h" #include "libplatform/libplatform.h" #include <iostream> #ifdef WASM_API_DEBUG #include <atomic> #endif namespace wasm_v8 { using namespace v8::wasm; } namespace v8 { namespace internal { extern bool FLA...
fim
wasmerio/wasmer
cpp
<|fim_suffix|> wasm_engine_t *engine = wasm_engine_new_with_config(config); return engine; } #endif <|fim_prefix|>// This header file is used only for test purposes! It is used by unit // test inside the `src/` directory for the moment. #ifndef TEST_WASM #define TEST_WASM #include "../wasm.h" #include "../wasmer.h...
fim
wasmerio/wasmer
c
<|fim_prefix|>#[cfg(test)] use std::error::Error; #[cfg(test)] use std::process::Stdio; #[cfg(test)] static INCLUDE_REGEX: &str = "#include \"(.*)\""; #[derive(Debug)] pub struct Config { pub wasmer_dir: String, pub root_dir: String, } impl Config { pub fn get() -> Config { let mut config = Confi...
fim
wasmerio/wasmer
rust
<|fim_suffix|>onst char *s) { wasm_byte_vec_new(out, strlen(s), s); } #endif /* TEST_WASMER */ <|fim_prefix|>// This header file is used only for test purposes! It is used by unit // test inside the `src/` directory for the moment. #ifndef TEST_WASMER #define TEST_WASMER #include "../wasmer.h" #include "wasm.h" #i...
fim
wasmerio/wasmer
c
<|fim_suffix|>ces WASM_DECLARE_REF(memory) typedef uint32_t wasm_memory_pages_t; static const size_t MEMORY_PAGE_SIZE = 0x10000; WASM_API_EXTERN own wasm_memory_t* wasm_memory_new(wasm_store_t*, const wasm_memorytype_t*); WASM_API_EXTERN own wasm_memorytype_t* wasm_memory_type(const wasm_memory_t*); WASM_API_EXTE...
fim
wasmerio/wasmer
c
<|fim_suffix|>ated, please use wasmer.h instead." <|fim_prefix|>#include "wasmer.h" #pragma message "The wasmer_was<|fim_middle|>m.h header file is being deprec<|endoftext|>
fim
wasmerio/wasmer
c
<|fim_suffix|>erion::default().sample_size(300); targets = store_cache, load_cache, store_cache_native, load_cache_native } criterion_main!(benches); <|fim_prefix|>#![allow(unused_imports)] use criterion::{Criterion, criterion_group, criterion_main}; use rand::distr::Alphanumeric; use rand::{Rng, RngExt, rng}; use ...
fim
wasmerio/wasmer
rust
//! The cache module provides the common data structures used by compiler backends to allow //! serializing compiled wasm code to a binary format. The binary format can be persisted, //! and loaded to allow skipping compilation and fast startup. use crate::hash::Hash; use std::error::Error; use wasmer::{AsEngineRef, ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>#![cfg_attr(not(feature = "filesystem"), allow(unused))] use crate::cache::Cache; use crate::hash::Hash; use std::fs::{File, create_dir_all}; use std::io::{self, Write}; use std::path::PathBuf; use wasmer::{AsEngineRef, DeserializeError, Module, SerializeError}; /// Representation of a directory that con...
fim
wasmerio/wasmer
rust
<|fim_suffix|>_slice(self.0, &mut buffer) .expect("Can never fail with a hard-coded buffer length"); let s = std::str::from_utf8(&buffer).map_err(|_| fmt::Error)?; f.write_str(s) } } impl FromStr for Hash { type Err = DeserializeError; /// Create hash from hexadecimal represent...
fim
wasmerio/wasmer
rust
<|fim_suffix|>eSystemCache; pub use crate::hash::Hash; // We re-export those for convenience of users pub use wasmer::{DeserializeError, SerializeError}; <|fim_prefix|>//! The `wasmer-cache` crate provides the necessary abstractions //! to cache WebAssembly Modules easily. #![deny(missing_docs, trivial_numeric_casts,...
fim
wasmerio/wasmer
rust
<|fim_suffix|>ible_build}"); } <|fim_prefix|>use chrono::prelude::*; pub fn main() { let reproducible_build = std::env::var("WASMER_REPRODUCIBLE_BUILD") .is_ok_and(|value| matches!(value.as_str(), "1" | "true")); if reproducible_build { // Avoid using the current time in reproducible builds. ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! Common module with common used structures across different //! commands. // NOTE: A lot of this code depends on feature flags. // To not go crazy with annotations, some lints are disabled for the whole // module. #![allow(dead_code, unused_imports, unused_variables)] use std::num::NonZero; use std::...
fim
wasmerio/wasmer
rust
<|fim_prefix|>#[cfg(not(feature = "backend"))] compile_error!( "<|fim_suffix|>wasmer-headless binary instead.\nWith cargo, you can provide a compiler option with the --features flag.\n\nExample values:\n\n\t\t--features cranelift,singlepass\n\n\t\t--features v8\n\n\n" ); fn main() { wasmer_cli::run_cli(); } <|...
fim
wasmerio/wasmer
rust
<|fim_suffix|>} <|fim_prefix|>fn main() { wasmer_cli::run_<|fim_middle|>cli(); <|endoftext|>
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! A convenient little abstraction for building up C expressions and generating //! simple C code. #![allow(dead_code)] pub mod staticlib_header; /// An identifier in C. pub type CIdent = String; /// A Type in the C language. #[derive(Debug, Clone, Default)] #[allow(dead_code)] pub enum CType { /...
fim
wasmerio/wasmer
rust
<|fim_suffix|> used for each function where // the type signature is not known statically. In this case, this corresponds to // the imported functions. "# .to_string(), }); c_statements.extend(dyn_func_declarations); c_statements.push(CStatement::TypeDef { source_type: CType::Function { ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use super::AsyncCliCommand; use crate::config::WasmerEnv; use anyhow::{Context, Error}; use clap::Parser; use std::process::{Command, Stdio}; use wasmer_backend_api::{ WasmerClient, types::{Bindings, ProgrammingLanguage}, }; use wasmer_config::package::NamedPackageIdent; /// Add a Wasmer package'...
fim
wasmerio/wasmer
rust
<|fim_suffix|>g, Some(working_dir.clone())).await?; self.try_deploy( owner.as_str(), app_name.as_str(), Some(&working_dir), true, true, ...
fim
wasmerio/wasmer
rust
<|fim_suffix|> &app.name, ) .await?; if !self.with_password { dbs.iter_mut().for_each(|db| { db.password = None; }); } if dbs.is_empty() { eprintln!("App {} has no databases!", app.name); } else { pr...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use crate::commands::AsyncCliCommand; pub mod list; /// App volume management. #[derive(Debug, clap::Parser)] pub enum CmdAppDatabase { // Credentials(credentials::CmdAppDatabaseCredentials), List(list::CmdAppDatabaseList), } #[async_trait::async_trait] impl AsyncCliCommand for CmdAppDatabase ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//<|fim_suffix|>_async(self) -> Result<(), anyhow::Error> { let interactive = !self.non_interactive; let client = self.env.client()?; eprintln!("Looking up the app..."); let (_ident, app) = self.ident.load_app(&client).await?; if interactive { let them...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use super::{AsyncCliCommand, util::login_user}; use crate::{ commands::{ PublishWait, app::create::{CmdAppCreate, minimal_app_config, write_app_config}, package::publish::PackagePublish, }, config::WasmerEnv, opts::ItemFormatOpts, utils::{DEFAULT_PACKAGE_MANIFES...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! <|fim_suffix|>truct CmdAppDeploymentGet { #[clap(flatten)] fmt: ItemFormatOpts, #[clap(flatten)] env: WasmerEnv, /// ID of the deployment. id: String, } #[async_trait::async_trait] impl AsyncCliCommand for CmdAppDeploymentGet { type Output = (); async fn run_async(m...
fim
wasmerio/wasmer
rust
<|fim_suffix|> of an app. #[derive(clap::Parser, Debug)] pub struct CmdAppDeploymentList { #[clap(flatten)] fmt: ListFormatOpts, #[clap(flatten)] env: WasmerEnv, #[clap(flatten)] ident: AppIdentOpts, #[clap(long)] offset: Option<u32>, #[clap(long)] limit: Option<u32>, } #[as...
fim
wasmerio/wasmer
rust
<|fim_suffix|>smer_backend_api::query::app_deployment(&client, self.id).await?; let url = item .log_url .context("This deployment does not have logs available")?; let mut writer = std::io::BufWriter::new(std::io::stdout()); let mut stream = reqwest::Client::new() ...
fim
wasmerio/wasmer
rust
<|fim_suffix|> } } <|fim_prefix|>use crate::commands::AsyncCliCommand; pub mod get; pub mod list; pub mod logs; /// App volume management. #[derive(Debug, clap::Parser)] pub enum CmdAppDeployment { List(list::CmdAppDeploymentList), <|fim_middle|> Get(get::CmdAppDeploymentGet), Logs(logs::CmdAppDeploymen...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! Get information about an edge app. use wasmer_backend_ap<|fim_suffix|>anyhow::Error> { let client = self.env.client()?; let (_ident, app) = self.ident.load_app(&client).await?; println!( "{}", self.fmt.get_with_default(ItemFormat::Yaml).render(&app) ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! Show short information about an Edge app. use super::util::AppIdentOpts; use crate::{commands::AsyncCliCommand, config::WasmerEnv}; /// Show short information about an Edge app. /// /// Use `app get` to get more detailed information. #[derive(clap::Parser, Debug)] pub struct CmdAppInfo { #[clap(...
fim
wasmerio/wasmer
rust
<|fim_suffix|> } if rsp.trim() == "n" { break 'list; } println!("unknown response: {rsp}"); } } display_apps.extend(apps.drain(..limit)); } if !display_apps.is_empty() { ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! Show logs for an Edge app. use crate::utils::timestamp::parse_timestamp_or_relative_time_negative_offset; use colored::Colorize; use comfy_table::{Cell, Table}; use futures::StreamExt; use time::{OffsetDateTime, format_description::well_known::Rfc3339}; use wasmer_backend_api::types::{Log, LogStream}...
fim
wasmerio/wasmer
rust
<|fim_suffix|> cmd.run_async().await?; Ok(()) } Self::List(cmd) => cmd.run_async().await, Self::Logs(cmd) => cmd.run_async().await, Self::Delete(cmd) => cmd.run_async().await, Self::Version(cmd) => cmd.run_async().await, ...
fim
wasmerio/wasmer
rust
<|fim_suffix|> <|fim_prefix|>//! Get information about an edge app. use anyhow::Context; use super::util::AppIdentOpts; use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ItemFormatOpts}; /// Purge caches for applications. /// /// Cache scopes that can be cleared: /// * InstaBoot startup snapshots /// ...
fim
wasmerio/wasmer
rust
<|fim_suffix|> #[async_trait::async_trait] impl AsyncCliCommand for CmdAppRegionsList { type Output = (); async fn run_async(self) -> Result<Self::Output, anyhow::Error> { let client = self.env.client()?; let regions = wasmer_backend_api::query::get_all_app_regions(&client).await?; pr...
fim
wasmerio/wasmer
rust
<|fim_suffix|> Ok(()) } } } } <|fim_prefix|>use crate::commands::AsyncCliCommand; pub mod list; mod utils; /// Information about available Edge regioins. #[derive(Debu<|fim_middle|>g, clap::Parser)] pub enum CmdAppRegions { List(list::CmdAppRegionsList), } #[async_trait::async...
fim
wasmerio/wasmer
rust
pub(crate) mod render; <|endoftext|>
fim
wasmerio/wasmer
rust
use crate::utils::render::CliRender; use comfy_table::{Cell, Table}; use wasmer_backend_api::types::AppRegion; impl CliRender for AppRegion { fn render_item_table(&self) -> String { let mut table = Table::new(); let AppRegion { name, city, country, .....
fim
wasmerio/wasmer
rust
<|fim_prefix|>use super::utils::Secret; use crate::{ commands::{AsyncCliCommand, app::util::AppIdentFlag}, config::WasmerEnv, }; use anyhow::Context; use colored::Colorize; use dialoguer::theme::ColorfulTheme; use std::io::IsTerminal as _; use std::{ collections::{HashMap, HashSet}, path::{Path, PathBuf...
fim
wasmerio/wasmer
rust
<|fim_suffix|>?; if let Some(secret) = secret { if !self.non_interactive && !self.force { let theme = ColorfulTheme::default(); let res = dialoguer::Confirm::with_theme(&theme) .with_prompt(format!("Delete secret '{}'?", secret_name.bold())) ...
fim
wasmerio/wasmer
rust
use super::utils; use crate::{ commands::{AsyncCliCommand, app::util::AppIdentFlag}, config::WasmerEnv, }; use std::io::IsTerminal as _; use std::path::PathBuf; #[derive(clap::Parser, Debug, Clone, Copy, PartialEq, Eq, Default, clap::ValueEnum)] pub enum SecretExportFormat { #[default] #[clap(name = "e...
fim
wasmerio/wasmer
rust
<|fim_suffix|>:Env => { let mut ret = vec![]; for item in dotenvy::from_path_iter(path)? { let (name, value) = item?; ret.push(Secret { name, value }) } Ok(ret) } SecretImportFormat::Json => {...
fim
wasmerio/wasmer
rust
<|fim_suffix|>ool, #[clap(flatten)] pub fmt: ListFormatOpts, /* --- Flags --- */ /// The identifier of the app to list secrets of. #[clap(flatten)] pub app_id: AppIdentFlag, /// The path to the directory where the config file for the application will be written to. #[clap(long = "app-...
fim
wasmerio/wasmer
rust
use crate::commands::AsyncCliCommand; pub mod create; pub mod delete; pub mod export; pub mod import; pub mod list; pub mod reveal; pub mod update; mod utils; /// Manage and reveal secrets related to Edge apps. #[derive(Debug, clap::Parser)] pub enum CmdAppSecrets { Create(create::CmdAppSecretsCreate), Delete...
fim
wasmerio/wasmer
rust
<|fim_suffix|>quiet: bool, /// Do not prompt for user input. #[clap(long, default_value_t = !std::io::stdin().is_terminal())] pub non_interactive: bool, #[clap(flatten)] pub fmt: Option<ListFormatOpts>, /* --- Flags --- */ #[clap(flatten)] pub app_id: AppIdentFlag, /// The path t...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use super::utils::Secret; use crate::{ commands::{AsyncCliCommand, app::util::AppIdentFlag}, config::WasmerEnv, }; use anyhow::Context; use colored::Colorize; use dialoguer::theme::ColorfulTheme; use std::io::IsTerminal as _; use std::{ collections::HashSet, path::{Path, PathBuf}, }; use w...
fim
wasmerio/wasmer
rust
<|fim_suffix|> app.name .clone() .context("App name has to be specified")? .to_string() }; let id = if let Some(id) = &app.app_id { Some(id.clone()) } else if let Ok(app_ident) = AppIdent::from_str(&app_name) { if l...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use super::{BackendSecretWrapper, Secret}; use crate::utils::render::CliRender; use colored::Colorize; use comfy_table::{Cell, Table}; use time::OffsetDateTime; use wasmer_backend_api::types::{DateTime, Secret as BackendSecret}; impl CliRender for Secret { fn render_item_table(&self) -> String { ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use std::{path::Path, str::FromStr}; use anyhow::{Context, bail}; use colored::Colorize; use dialoguer::{Confirm, theme::ColorfulTheme}; use wasmer_backend_api::{ WasmerClient, global_id::{GlobalId, NodeKind}, types::DeployApp, }; use wasmer_config::app::AppConfigV1; use crate::{ command...
fim
wasmerio/wasmer
rust
<|fim_suffix|>pub struct CmdAppVersionActivate { #[clap(flatten)] pub env: WasmerEnv, #[clap(flatten)] pub fmt: ItemFormatOpts, /// App version ID to activate. /// /// This must be the unique version ID, not the version name! /// Eg: dav_xYzaB1aaaaax pub version: String, } #[async...
fim
wasmerio/wasmer
rust
use anyhow::Context; use crate::{ commands::{AsyncCliCommand, app::util::AppIdentOpts}, config::WasmerEnv, opts::ItemFormatOpts, utils::render::ItemFormat, }; /// Show information for a specific app version. #[derive(clap::Parser, Debug)] pub struct CmdAppVersionGet { #[clap(flatten)] pub env:...
fim
wasmerio/wasmer
rust
use wasmer_backend_api::types::{DeployAppVersionsSortBy, GetDeployAppVersionsVars}; use crate::{ commands::{AsyncCliCommand, app::util::AppIdentOpts}, config::WasmerEnv, opts::ListFormatOpts, }; /// List versions of an app. #[derive(clap::Parser, Debug)] pub struct CmdAppVersionList { #[clap(flatten)]...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! Edge app version management. use crate::commands::AsyncCliCommand; pub mod activate; pub mod get; <|fim_suffix|>nc().await, } } } <|fim_middle|>pub mod list; /// Manage app versions. #[derive(clap::Subcommand, Debug)] pub enum CmdAppVersion { Get(get::CmdAppVersionGet), List(lis...
fim
wasmerio/wasmer
rust
<|fim_prefix|>pub(super) mod rotate_secrets; use crate::{ commands::{AsyncCliCommand, app::util::AppIdentOpts}, config::WasmerEnv, }; /// Retrieve access credentials for the volumes of an app. /// /// The credentials can be used to access volum<|fim_suffix|>point} "#, app_name = app.name,...
fim
wasmerio/wasmer
rust
use super::ItemFormatOpts; use crate::{ commands::{ AsyncCliCommand, app::util::{AppIdent, AppIdentOpts}, }, config::WasmerEnv, }; /// Rotate the secrets linked to volumes of an app. #[derive(clap::Parser, Debug)] pub struct CmdAppVolumesRotateSecrets { #[clap(flatten)] pub env: Was...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! List volumes tied to an edge app. use super::super::util::AppIdentOpts; use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ListFormatOpts}; /// List the volumes of an app. #[derive(clap::Parser, Debug)] pub struct CmdAppVolumesList { #[clap(flatten)] fmt: ListFormatOpts, #[...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use crate::commands::AsyncCliCommand; pub mod credentials; pub mod list; /// App volume management. #[derive(Debug, clap::Parser)] pub enum CmdAppVolumes { Credentials(credentials::CmdAppVolumesCredentials), List(list::CmdAppVolumesList), RotateSecrets(credentials::rotate_secrets<|fim_suffix...
fim
wasmerio/wasmer
rust
use super::AuthorizationState; use http_body_util::BodyExt; use hyper::{Request, Response, StatusCode, body::Incoming}; use reqwest::{Body, Method}; use tokio::net::TcpListener; /// A utility struct used to manage the local server for browser-based authorization. #[derive(Clone)] pub(super) struct BrowserAuthContext {...
fim
wasmerio/wasmer
rust
<|fim_prefix|>mod auth_server; use auth_server::*; use colored::Colorize; use hyper::{server::conn::http1::Builder, service::service_fn}; use hyper_util::server::graceful::GracefulShutdown; use crate::{ commands::AsyncCliCommand, config::{UpdateRegistry, UserRegistry, WasmerConfig, WasmerEnv}, }; use futures_u...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use crate::{ commands::AsyncCliCommand, config::{DEFAULT_PROD_REGISTRY, WasmerConfig, WasmerEnv}, }; use colored::Colorize; use std::io::IsTerminal as _; /// Log out from Wasmer #[derive(Debug, Clone, clap::Parser)] pub struct Logout { #[clap(flatten)] env: WasmerEnv, /// Do not prom...
fim
wasmerio/wasmer
rust
<|fim_suffix|>w) => w.run_async().await, } } } <|fim_prefix|>mod login; mod logout; mod whoami; pub use login::*; pub use whoami::*; use super::AsyncCliCommand; /// Manage authentication in Wasmer #[derive(clap::Subcommand, Debug)] pub enum CmdAuth { Login(login::Login), Logout(logout::Logout),<|...
fim
wasmerio/wasmer
rust
<|fim_suffix|>&client) .await? .ok_or_else(|| anyhow::anyhow!("Not logged in registry {host_str}"))?; println!( "Logged into registry {host_str} as user {}", user.username.bold() ); Ok(()) } } <|fim_prefix|>use clap::Parser; use colored::Colori...
fim
wasmerio/wasmer
rust
use std::{ env, fs::{self, Permissions}, io::Write, os::unix::{ ffi::OsStrExt, fs::{MetadataExt, PermissionsExt}, }, path::{Path, PathBuf}, }; use Action::*; use anyhow::{Context, Result, bail}; use clap::Parser; #[derive(Debug, Parser, Clone, Copy)] enum Action { /// Regis...
fim
wasmerio/wasmer
rust
<|fim_suffix|> Ok(()) } <|fim_prefix|>use crate::config::WasmerEnv; use anyhow::Result; use c<|fim_middle|>lap::Parser; use std::{fs, path::Path}; #[derive(Debug, Parser)] /// The options for the `wasmer cache` subcommand pub struct Cache { #[clap(flatten)] env: WasmerEnv, /// The operation to perform. ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use std::path::PathBuf; use anyhow::{Context, Result, bail}; use clap::Parser; use wasmer::{sys::*, *}; use crate::{backend::RuntimeOptions, warning}; #[derive(Debug, Parser)] /// The options for the `wasmer compile` subcommand pub struct Compile { /// Input file #[clap(name = "FILE")] path...
fim
wasmerio/wasmer
rust
<|fim_suffix|>be used #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Parser)] pub struct SetProxyUrl { /// Set if a proxy URL should be used (empty = unset proxy) #[clap(name = "URL")] pub url: String, } #[async_trait::async_trait] impl AsyncCliCommand for Config { type Output = (); /// Ru...
fim
wasmerio/wasmer
rust
<|fim_suffix|>way: {}/{} -> {}", // route.cidr.ip, route.cidr.prefix, route.via_router // ); // } // for cidr in socket.ips().iter() { // if let Some((app_id, _)) = // AppId::from_ip(&cidr.ip, NetworkIdEncodingMethod::PrivateProjection) // { ...
fim
wasmerio/wasmer
rust
mod unpack; pub use unpack::PackageUnpack; /// Container related commands. (inspecting, unpacking, ...) #[derive(clap::Subcommand, Debug)] // Allowing missing_docs because the comment would override the doc comment on // the command struct. #[allow(missing_docs)] pub enum Container { Unpack(PackageUnpack), } <|en...
fim
wasmerio/wasmer
rust
<|fim_prefix|>/// RENAMED: the 'container unpack' command has been renamed to 'package unpack'! #[derive(clap::Parser, Debug)] pub struct PackageUnpack {} impl PackageUnpack { pub(crate) fn exe<|fim_suffix|>se 'wasmer package unpack instead'"); } } <|fim_middle|>cute(&self) -> Result<(), anyhow::Error> { ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! Create a standalone native executable for a given Wasm file. use self::utils::normalize_atom_name; use super::CliCommand; use crate::{backend::RuntimeOptions, common::normalize_path, config::WasmerEnv}; use anyhow::{Context, Result, anyhow, bail}; use clap::Parser; use object::ObjectSection; use serd...
fim
wasmerio/wasmer
rust
<|fim_prefix|>#![allow(dead_code)] //! Create a standalone native executable for a given Wasm file. use std::{env, path::PathBuf}; use anyhow::{Context, Result}; use clap::Parser; use wasmer::sys::*; use wasmer_package::utils::from_disk; use crate::backend::RuntimeOptions; #[derive(Debug, Parser)] /// The options f...
fim
wasmerio/wasmer
rust
use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ItemTableFormatOpts}; /// Show a domain #[derive(clap::Parser, Debug)] pub struct CmdDomainGet { #[clap(flatten)] fmt: ItemTableFormatOpts, #[clap(flatten)] env: WasmerEnv, /// Name of the domain. name: String, } #[async_trait::...
fim
wasmerio/wasmer
rust
use wasmer_backend_api::types::GetAllDomainsVariables; use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ListFormatOpts}; /// List domains. #[derive(clap::Parser, Debug)] pub struct CmdDomainList { #[clap(flatten)] fmt: ListFormatOpts, #[clap(flatten)] env: WasmerEnv, /// Name of t...
fim
wasmerio/wasmer
rust
<|fim_suffix|>:Error> { match self { CmdDomain::List(cmd) => cmd.run_async().await, CmdDomain::Get(cmd) => cmd.run_async().await, CmdDomain::GetZoneFile(cmd) => cmd.run_async().await, CmdDomain::SyncZoneFile(cmd) => cmd.run_async().await, CmdDomain::Re...
fim
wasmerio/wasmer
rust
<|fim_suffix|>ient = self.env.client()?; let domain = wasmer_backend_api::query::register_domain( &client, self.name, self.namespace, Some(self.import_records), ) .await?; println!( "{}: domain registered under owner `{}`", ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ItemFormatOpts}; use anyhow::Context; #[derive(clap::Parser, Debug)] /// Show a zone file pub struct CmdZoneFileGet { #[clap(flatten)] fmt: ItemFormatOpts, #[clap(flatten)] env: WasmerEnv, /// Name of the domain. do...
fim
wasmerio/wasmer
rust
use std::path::PathBuf; use anyhow::{Context, Error}; use bytes::Bytes; use clap::Parser; use wasmer_compiler::{ Artifact, object::ObjectMetadataBuilder, types::symbols::ModuleMetadataSymbolRegistry, }; use wasmer_package::{package::WasmerPackageError, utils::from_bytes}; use wasmer_types::target::{CpuFeature, Tri...
fim
wasmerio/wasmer
rust
<|fim_suffix|> generate(self.shell, &mut cmd, name, &mut f); Ok(()) } else { generate(self.shell, &mut cmd, name, &mut std::io::stdout()); Ok(()) } } } <|fim_prefix|>use super::WasmerCmd; use clap::CommandFactory; use clap_complete::{Shell, generate}; use std::fs...
fim
wasmerio/wasmer
rust
<|fim_suffix|>bug, Clone, clap::Parser)] pub struct CmdGenManPage { /// Where to store the generated file(s) to. #[clap(long, default_value = DEFAULT_MAN_DIR_PATH.as_os_str())] pub out: PathBuf, } impl CmdGenManPage { pub fn execute(&self) -> anyhow::Result<()> { let cmd = WasmerCmd::command();...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use crate::config::WasmerEnv; use anyhow::Context; use cargo_metadata::{CargoOpt, MetadataCommand}; use clap::Parser; use indexmap::IndexMap; use semver::VersionReq; use std::path::{Path, PathBuf}; use super::AsyncCliCommand; static NOTE: &str = "# See more keys and definitions at https://docs.wasmer.io...
fim
wasmerio/wasmer
rust
<|fim_suffix|> for f in module.imports().globals() { println!(" \"{}\".\"{}\": {}", f.module(), f.name(), f.ty()); } println!(" Tags:"); for f in module.imports().tags() { println!(" \"{}\".\"{}\": {}", f.module(), f.name(), f.ty()); } println!("Ex...
fim
wasmerio/wasmer
rust
<|fim_suffix|>CompactingLogFileJournal::new(&self.journal_path)?.with_compact_on_drop(); drop(compactor); let journal = LogFileJournal::new(&self.journal_path)?; let printer = PrintingJournal::default(); copy_journal(&journal, &printer)?; Ok(()) } } <|fim_prefix|>use std::pa...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use std::path::PathBuf; use clap::Parser; use wasmer_wasix::journal::{JournalPrintingMode, LogFileJournal, PrintingJournal, copy_journal}; use crate::commands::CliCommand; /// Exports all the events in a journal to STDOUT as JSON data #[derive(Debug, Parser)] pub struct CmdJournalExport { /// Path ...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use std::path::PathBuf; use clap::Parser; use wasmer_wasix::journal::{LogFileJournal, copy_journal}; use crate::commands::CliCommand; #[derive(Debug, Parser)] pub struct CmdExtractWhatMemory { /// Path to the memory file that will be up<|fim_suffix|> match self.what { CmdExtract...
fim
wasmerio/wasmer
rust
use std::{path::PathBuf, str::FromStr}; use clap::Parser; use wasmer_wasix::journal::{ FilteredJournalBuilder, LogFileJournal, PrintingJournal, copy_journal, }; use crate::commands::CliCommand; /// Flags that specify what should be filtered out #[derive(Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] ...
fim
wasmerio/wasmer
rust
<|fim_suffix|>s)?; println!("{record}"); journal.write(record)?; lines.clear(); } } } <|fim_prefix|>use std::{io::ErrorKind, path::PathBuf}; use clap::Parser; use wasmer_wasix::journal::{JournalEntry, LogFileJournal, WritableJournal}; use crate::commands::CliCommand; /...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use std::path::PathBuf; use clap::Parser; use wasmer_wasix::journal::{LogFileJournal, PrintingJournal, copy_journal}; use crate::commands::CliCommand; /// Prints a summarized version of contents of a journal to stdout #[derive(Debug, Parser)] pub struct CmdJournalInspect { /// Path to the journal t...
fim
wasmerio/wasmer
rust
<|fim_prefix|>use crate::commands::CliCommand; mod compact; mod export; mod extract; mod filter; mod import; mod inspect; pub use compact::*; pub use export::*; pub use extract::*; pub use filter::*; pub use import::*; pub use inspect::*; /// Manage Journal files. #[derive(clap::Subcommand, Debug)] pub enum CmdJourn...
fim
wasmerio/wasmer
rust
<|fim_prefix|>//! The commands available in the Wasmer binary. mod add; mod app; mod auth; #[cfg(target_os = "linux")] mod binfmt; mod cache; #[cfg(feature = "compiler")] mod compile; mod config; mod connect; mod container; #[cfg(any(feature = "static-artifact-create", feature = "wasmer-artifact-create"))] mod create_e...
fim
wasmerio/wasmer
rust
<|fim_suffix|>{}", self.fmt.get().render(&namespace)); Ok(()) } } <|fim_prefix|>use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ItemFormatOpts}; /// Create a new namespace. #[derive(clap::Parser, Debug)] pub struct CmdNamespaceCreate {<|fim_middle|> #[clap(flatten)] fmt: ItemFormat...
fim
wasmerio/wasmer
rust
use anyhow::Context; use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ItemFormatOpts}; /// Show a namespace. #[derive(clap::Parser, Debug)] pub struct CmdNamespaceGet { #[clap(flatten)] fmt: ItemFormatOpts, #[clap(flatten)] env: WasmerEnv, /// Name of the namespace. name: Stri...
fim
wasmerio/wasmer
rust
use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ListFormatOpts}; /// List namespaces. #[derive(clap::Parser, Debug)] pub struct CmdNamespaceList { #[clap(flatten)] fmt: ListFormatOpts, #[clap(flatten)] env: WasmerEnv, } #[async_trait::async_trait] impl AsyncCliCommand for CmdNamespaceL...
fim
wasmerio/wasmer
rust
<|fim_suffix|> match self { CmdNamespace::List(cmd) => cmd.run_async().await, CmdNamespace::Get(cmd) => cmd.run_async().await, } } } <|fim_prefix|>pub mod create; pub mod get; pub mod list; use crate::commands::AsyncCliCommand; /// Manage names<|fim_middle|>paces. #[derive(c...
fim
wasmerio/wasmer
rust