Skip to content

Commit 4d042cb

Browse files
committed
[Rust] Update dependencies
1 parent 9660109 commit 4d042cb

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

src/fable-library-rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ num-integer = { version = "0.1", optional = true }
2929
num-traits = { version = "0.2", optional = true }
3030
rand = { version = "0.10", features = ["std_rng"], default-features = false, optional = true }
3131
regex = { version = "1.12", optional = true }
32-
rust_decimal = { version = "1.40", features = ["maths"], default-features = false, optional = true }
32+
rust_decimal = { version = "1.41", features = ["maths"], default-features = false, optional = true }
3333
startup = { version = "0.1", path = "vendored/startup", optional = true }
3434

3535
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

src/fable-library-rust/src/Random.rs

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub mod Random_ {
88

99
use crate::Native_::{LrcPtr, MutCell};
1010
use crate::NativeArray_::Array;
11-
use core::fmt;
1211

1312
#[repr(transparent)]
1413
pub struct Random(MutCell<RngImpl>);
@@ -62,8 +61,8 @@ pub mod Random_ {
6261
// }
6362
// }
6463

65-
impl fmt::Debug for Random {
66-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
64+
impl core::fmt::Debug for Random {
65+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
6766
f.debug_struct("Random").finish()
6867
}
6968
}
@@ -76,3 +75,52 @@ pub mod Random_ {
7675
LrcPtr::new(Random::new_seeded(seed))
7776
}
7877
}
78+
79+
// stub implementation of System.Random for when the "random" feature is not enabled
80+
#[cfg(not(feature = "random"))]
81+
pub mod Random_ {
82+
use crate::Native_::{LrcPtr, MutCell};
83+
use crate::NativeArray_::Array;
84+
85+
pub struct Random;
86+
87+
const MSG: &str = "Using System.Random requires enabling the 'random' feature";
88+
89+
impl Random {
90+
pub fn new() -> Self {
91+
unimplemented!("{}", MSG)
92+
}
93+
94+
pub fn new_seeded(seed: i32) -> Self {
95+
unimplemented!("{}", MSG)
96+
}
97+
98+
pub fn next0(&self) -> i32 {
99+
unimplemented!("{}", MSG)
100+
}
101+
102+
pub fn next1(&self, max_value: i32) -> i32 {
103+
unimplemented!("{}", MSG)
104+
}
105+
106+
pub fn next2(&self, min_value: i32, max_value: i32) -> i32 {
107+
unimplemented!("{}", MSG)
108+
}
109+
110+
pub fn nextDouble(&self) -> f64 {
111+
unimplemented!("MSG")
112+
}
113+
114+
pub fn nextBytes(&self, buffer: Array<u8>) {
115+
unimplemented!("{}", MSG)
116+
}
117+
}
118+
119+
pub fn new() -> LrcPtr<Random> {
120+
unimplemented!("{}", MSG)
121+
}
122+
123+
pub fn new_seeded(seed: i32) -> LrcPtr<Random> {
124+
unimplemented!("{}", MSG)
125+
}
126+
}

0 commit comments

Comments
 (0)