Skip to content

Commit

Permalink
Add deref for idiomatic value access
Browse files Browse the repository at this point in the history
  • Loading branch information
twitu committed May 18, 2022
1 parent 7a5196c commit b7841b7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nautilus_core/model/src/identifiers/venue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

use nautilus_core::string::{pystr_to_string, string_to_pystr};
use nautilus_core::impl_interconvert_pystring_trait;
use nautilus_core::string::{pystr_to_string, string_to_pystr};
use pyo3::ffi;
use std::fmt::{Debug, Display, Formatter, Result};
use std::ops::Deref;

#[repr(C)]
#[derive(Clone, Hash, PartialEq, Debug)]
Expand All @@ -39,6 +40,14 @@ impl Display for Venue {
}
}

impl Deref for Venue {
type Target = String;

fn deref(&self) -> &Self::Target {
&self.value
}
}

////////////////////////////////////////////////////////////////////////////////
// C API
////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit b7841b7

Please sign in to comment.