Skip to content

Commit

Permalink
fix truncated string value problem (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
reiase authored May 23, 2023
1 parent eeda715 commit 83e1811
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyperparameter"
version = "0.1.0"
version = "0.5.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -11,7 +11,6 @@ crate-type = ["cdylib"]

[dependencies]
cxx = "1.0"
arraystring = "0.3.0"
pyo3 = { version = "0.18.1", features = [
"extension-module",
"abi3",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "hyperparameter"
version = "0.5.1"
version = "0.5.2"
authors = [{ name = "Reiase", email = "[email protected]" }]
description = "A hyper-parameter library for researchers, data scientists and machine learning engineers."
requires-python = ">=3.7"
Expand Down
9 changes: 4 additions & 5 deletions src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use arraystring::CacheString;
use std::{ffi::c_void, sync::Arc};

#[derive(Debug, Clone, PartialEq)]
Expand All @@ -15,7 +14,7 @@ pub enum Value {
Empty,
Int(i64),
Float(f64),
Text(CacheString),
Text(String),
Boolen(bool),
UserDefined(
*mut c_void, //data
Expand All @@ -38,19 +37,19 @@ impl From<f64> for Value {

impl From<String> for Value {
fn from(value: String) -> Self {
Value::Text(CacheString::from_str_truncate(value))
Value::Text(value)
}
}

impl From<&String> for Value {
fn from(value: &String) -> Self {
Value::Text(CacheString::from_str_truncate(value))
Value::Text(value.clone())
}
}

impl From<&str> for Value {
fn from(value: &str) -> Self {
Value::Text(CacheString::from_str_truncate(value))
Value::Text(value.to_string())
}
}

Expand Down

0 comments on commit 83e1811

Please sign in to comment.