Skip to content

Commit

Permalink
fix: compile when targeting Wasm again (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Dec 20, 2024
1 parent 015f721 commit d3844cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ serde = { version = "1.0.130", features = ["derive", "rc"] }
thiserror = "2"
url = "2.5.3"
deno_error = "0.5.1"
capacity_builder = { version = "0.5.0", features = ["ecow"] }
ecow = { version = "0.2.3", features = ["serde"] }

# todo(dsherret): remove after https://github.com/polazarus/hipstr/pull/39 is released
[target.'cfg(any(unix, windows))'.dependencies]
capacity_builder = { version = "0.5.0", features = ["ecow", "hipstr"] }
hipstr = "0.6"
ecow = { version = "0.2.3", features = ["serde"] }

[dev-dependencies]
divan = "0.1.17"
Expand Down
15 changes: 11 additions & 4 deletions src/string.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.

use std::borrow::Borrow;
use std::fmt;
use std::ops::Deref;

use capacity_builder::StringAppendable;
use capacity_builder::StringType;
use serde::de::Error;
use serde::de::Visitor;
use serde::Deserialize;
use serde::Deserializer;
use serde::Serialize;

macro_rules! shared {
Expand Down Expand Up @@ -141,7 +137,13 @@ macro_rules! shared {
};
}

#[cfg(any(unix, windows))]
mod stack_string {
use serde::de::Error;
use serde::de::Visitor;
use serde::Deserializer;
use std::fmt;

use super::*;

/// A 24 byte string that uses the stack when < 24 bytes.
Expand Down Expand Up @@ -254,6 +256,7 @@ mod stack_string {

mod small_stack_string {
use super::*;

/// A 16 byte string that uses the stack when < 16 bytes.
#[derive(
Debug,
Expand Down Expand Up @@ -421,4 +424,8 @@ mod regular_string {

// this is here to allow easily swapping implementations
pub use small_stack_string::SmallStackString;

#[cfg(not(any(unix, windows)))]
pub use regular_string::RegularString as StackString;
#[cfg(any(unix, windows))]
pub use stack_string::StackString;

0 comments on commit d3844cb

Please sign in to comment.