Skip to main content

Utf8Data

Trait Utf8Data 

Source
pub trait Utf8Data {
    // Required method
    fn utf8_bytes(&self) -> &[u8] ;
}
Expand description

Adapter for common Rust string types to Onnx strings.

It should be easy to use both String and &str as TensorElementDataType::String data, but we can’t define an automatic implementation for anything that implements AsRef<str> as it would conflict with the implementations of TypeToTensorElementDataType for primitive numeric types (which might implement AsRef<str> at some point in the future).

Required Methods§

Source

fn utf8_bytes(&self) -> &[u8]

Returns the utf8 contents.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Utf8Data for String

Source§

fn utf8_bytes(&self) -> &[u8]

Source§

impl<'a> Utf8Data for &'a str

Source§

fn utf8_bytes(&self) -> &[u8]

Implementors§