Struct GzipCodec

Source
pub struct GzipCodec { /* private fields */ }
Available on crate feature gzip only.
Expand description

A gzip codec implementation.

Implementations§

Source§

impl GzipCodec

Source

pub fn new(compression_level: u32) -> Result<Self, GzipCompressionLevelError>

Create a new gzip codec.

§Errors

Returns GzipCompressionLevelError if compression_level is not valid.

Examples found in repository?
examples/custom_data_type_variable_size.rs (line 170)
153fn main() {
154    let store = std::sync::Arc::new(MemoryStore::default());
155    let array_path = "/array";
156    let array = ArrayBuilder::new(
157        vec![4, 1], // array shape
158        DataType::Extension(Arc::new(CustomDataTypeVariableSize)),
159        vec![3, 1].try_into().unwrap(), // regular chunk shape
160        FillValue::from(vec![]),
161    )
162    .array_to_array_codecs(vec![
163        #[cfg(feature = "transpose")]
164        Arc::new(zarrs::array::codec::TransposeCodec::new(
165            zarrs::array::codec::array_to_array::transpose::TransposeOrder::new(&[1, 0]).unwrap(),
166        )),
167    ])
168    .bytes_to_bytes_codecs(vec![
169        #[cfg(feature = "gzip")]
170        Arc::new(zarrs::array::codec::GzipCodec::new(5).unwrap()),
171        #[cfg(feature = "crc32c")]
172        Arc::new(zarrs::array::codec::Crc32cCodec::new()),
173    ])
174    // .storage_transformers(vec![].into())
175    .build(store, array_path)
176    .unwrap();
177    println!("{}", array.metadata().to_string_pretty());
178
179    let data = [
180        CustomDataTypeVariableSizeElement::from(Some(1.0)),
181        CustomDataTypeVariableSizeElement::from(None),
182        CustomDataTypeVariableSizeElement::from(Some(3.0)),
183    ];
184    array.store_chunk_elements(&[0, 0], &data).unwrap();
185
186    let data = array
187        .retrieve_array_subset_elements::<CustomDataTypeVariableSizeElement>(&array.subset_all())
188        .unwrap();
189
190    assert_eq!(data[0], CustomDataTypeVariableSizeElement::from(Some(1.0)));
191    assert_eq!(data[1], CustomDataTypeVariableSizeElement::from(None));
192    assert_eq!(data[2], CustomDataTypeVariableSizeElement::from(Some(3.0)));
193    assert_eq!(data[3], CustomDataTypeVariableSizeElement::from(None));
194
195    println!("{data:#?}");
196}
More examples
Hide additional examples
examples/custom_data_type_fixed_size.rs (line 287)
269fn main() {
270    let store = std::sync::Arc::new(MemoryStore::default());
271    let array_path = "/array";
272    let fill_value = CustomDataTypeFixedSizeElement { x: 1, y: 2.3 };
273    let array = ArrayBuilder::new(
274        vec![4, 1], // array shape
275        DataType::Extension(Arc::new(CustomDataTypeFixedSize)),
276        vec![2, 1].try_into().unwrap(), // regular chunk shape
277        FillValue::new(fill_value.to_ne_bytes().to_vec()),
278    )
279    .array_to_array_codecs(vec![
280        #[cfg(feature = "transpose")]
281        Arc::new(zarrs::array::codec::TransposeCodec::new(
282            zarrs::array::codec::array_to_array::transpose::TransposeOrder::new(&[1, 0]).unwrap(),
283        )),
284    ])
285    .bytes_to_bytes_codecs(vec![
286        #[cfg(feature = "gzip")]
287        Arc::new(zarrs::array::codec::GzipCodec::new(5).unwrap()),
288        #[cfg(feature = "crc32c")]
289        Arc::new(zarrs::array::codec::Crc32cCodec::new()),
290    ])
291    // .storage_transformers(vec![].into())
292    .build(store, array_path)
293    .unwrap();
294    println!("{}", array.metadata().to_string_pretty());
295
296    let data = [
297        CustomDataTypeFixedSizeElement { x: 3, y: 4.5 },
298        CustomDataTypeFixedSizeElement { x: 6, y: 7.8 },
299    ];
300    array.store_chunk_elements(&[0, 0], &data).unwrap();
301
302    let data = array
303        .retrieve_array_subset_elements::<CustomDataTypeFixedSizeElement>(&array.subset_all())
304        .unwrap();
305
306    assert_eq!(data[0], CustomDataTypeFixedSizeElement { x: 3, y: 4.5 });
307    assert_eq!(data[1], CustomDataTypeFixedSizeElement { x: 6, y: 7.8 });
308    assert_eq!(data[2], CustomDataTypeFixedSizeElement { x: 1, y: 2.3 });
309    assert_eq!(data[3], CustomDataTypeFixedSizeElement { x: 1, y: 2.3 });
310
311    println!("{data:#?}");
312}
examples/custom_data_type_uint12.rs (line 224)
205fn main() {
206    let store = std::sync::Arc::new(MemoryStore::default());
207    let array_path = "/array";
208    let fill_value = CustomDataTypeUInt12Element::try_from(15).unwrap();
209    let array = ArrayBuilder::new(
210        vec![4096, 1], // array shape
211        DataType::Extension(Arc::new(CustomDataTypeUInt12)),
212        vec![5, 1].try_into().unwrap(), // regular chunk shape
213        FillValue::new(fill_value.to_le_bytes().to_vec()),
214    )
215    .array_to_array_codecs(vec![
216        #[cfg(feature = "transpose")]
217        Arc::new(zarrs::array::codec::TransposeCodec::new(
218            zarrs::array::codec::array_to_array::transpose::TransposeOrder::new(&[1, 0]).unwrap(),
219        )),
220    ])
221    .array_to_bytes_codec(Arc::new(zarrs::array::codec::PackBitsCodec::default()))
222    .bytes_to_bytes_codecs(vec![
223        #[cfg(feature = "gzip")]
224        Arc::new(zarrs::array::codec::GzipCodec::new(5).unwrap()),
225        #[cfg(feature = "crc32c")]
226        Arc::new(zarrs::array::codec::Crc32cCodec::new()),
227    ])
228    // .storage_transformers(vec![].into())
229    .build(store, array_path)
230    .unwrap();
231    println!("{}", array.metadata().to_string_pretty());
232
233    let data: Vec<CustomDataTypeUInt12Element> = (0..4096)
234        .into_iter()
235        .map(|i| CustomDataTypeUInt12Element::try_from(i).unwrap())
236        .collect();
237
238    array
239        .store_array_subset_elements(&array.subset_all(), &data)
240        .unwrap();
241
242    let data = array
243        .retrieve_array_subset_elements::<CustomDataTypeUInt12Element>(&array.subset_all())
244        .unwrap();
245
246    for i in 0usize..4096 {
247        let element = CustomDataTypeUInt12Element::try_from(i as u64).unwrap();
248        assert_eq!(data[i], element);
249        let element_pd = array
250            .retrieve_array_subset_elements::<CustomDataTypeUInt12Element>(
251                &ArraySubset::new_with_ranges(&[(i as u64)..i as u64 + 1, 0..1]),
252            )
253            .unwrap()[0];
254        assert_eq!(element_pd, element);
255    }
256}
examples/custom_data_type_float8_e3m4.rs (line 235)
217fn main() {
218    let store = std::sync::Arc::new(MemoryStore::default());
219    let array_path = "/array";
220    let fill_value = CustomDataTypeFloat8e3m4Element::from(1.23);
221    let array = ArrayBuilder::new(
222        vec![6, 1], // array shape
223        DataType::Extension(Arc::new(CustomDataTypeFloat8e3m4)),
224        vec![5, 1].try_into().unwrap(), // regular chunk shape
225        FillValue::new(fill_value.to_ne_bytes().to_vec()),
226    )
227    .array_to_array_codecs(vec![
228        #[cfg(feature = "transpose")]
229        Arc::new(zarrs::array::codec::TransposeCodec::new(
230            zarrs::array::codec::array_to_array::transpose::TransposeOrder::new(&[1, 0]).unwrap(),
231        )),
232    ])
233    .bytes_to_bytes_codecs(vec![
234        #[cfg(feature = "gzip")]
235        Arc::new(zarrs::array::codec::GzipCodec::new(5).unwrap()),
236        #[cfg(feature = "crc32c")]
237        Arc::new(zarrs::array::codec::Crc32cCodec::new()),
238    ])
239    // .storage_transformers(vec![].into())
240    .build(store, array_path)
241    .unwrap();
242    println!("{}", array.metadata().to_string_pretty());
243
244    let data = [
245        CustomDataTypeFloat8e3m4Element::from(2.34),
246        CustomDataTypeFloat8e3m4Element::from(3.45),
247        CustomDataTypeFloat8e3m4Element::from(f32::INFINITY),
248        CustomDataTypeFloat8e3m4Element::from(f32::NEG_INFINITY),
249        CustomDataTypeFloat8e3m4Element::from(f32::NAN),
250    ];
251    array.store_chunk_elements(&[0, 0], &data).unwrap();
252
253    let data = array
254        .retrieve_array_subset_elements::<CustomDataTypeFloat8e3m4Element>(&array.subset_all())
255        .unwrap();
256
257    for f in &data {
258        println!(
259            "float8_e3m4: {:08b} f32: {}",
260            f.to_ne_bytes()[0],
261            f.as_f32()
262        );
263    }
264
265    assert_eq!(data[0], CustomDataTypeFloat8e3m4Element::from(2.34));
266    assert_eq!(data[1], CustomDataTypeFloat8e3m4Element::from(3.45));
267    assert_eq!(
268        data[2],
269        CustomDataTypeFloat8e3m4Element::from(f32::INFINITY)
270    );
271    assert_eq!(
272        data[3],
273        CustomDataTypeFloat8e3m4Element::from(f32::NEG_INFINITY)
274    );
275    assert_eq!(data[4], CustomDataTypeFloat8e3m4Element::from(f32::NAN));
276    assert_eq!(data[5], CustomDataTypeFloat8e3m4Element::from(1.23));
277}
examples/custom_data_type_uint4.rs (line 222)
203fn main() {
204    let store = std::sync::Arc::new(MemoryStore::default());
205    let array_path = "/array";
206    let fill_value = CustomDataTypeUInt4Element::try_from(15).unwrap();
207    let array = ArrayBuilder::new(
208        vec![6, 1], // array shape
209        DataType::Extension(Arc::new(CustomDataTypeUInt4)),
210        vec![5, 1].try_into().unwrap(), // regular chunk shape
211        FillValue::new(fill_value.to_ne_bytes().to_vec()),
212    )
213    .array_to_array_codecs(vec![
214        #[cfg(feature = "transpose")]
215        Arc::new(zarrs::array::codec::TransposeCodec::new(
216            zarrs::array::codec::array_to_array::transpose::TransposeOrder::new(&[1, 0]).unwrap(),
217        )),
218    ])
219    .array_to_bytes_codec(Arc::new(zarrs::array::codec::PackBitsCodec::default()))
220    .bytes_to_bytes_codecs(vec![
221        #[cfg(feature = "gzip")]
222        Arc::new(zarrs::array::codec::GzipCodec::new(5).unwrap()),
223        #[cfg(feature = "crc32c")]
224        Arc::new(zarrs::array::codec::Crc32cCodec::new()),
225    ])
226    // .storage_transformers(vec![].into())
227    .build(store, array_path)
228    .unwrap();
229    println!("{}", array.metadata().to_string_pretty());
230
231    let data = [
232        CustomDataTypeUInt4Element::try_from(1).unwrap(),
233        CustomDataTypeUInt4Element::try_from(2).unwrap(),
234        CustomDataTypeUInt4Element::try_from(3).unwrap(),
235        CustomDataTypeUInt4Element::try_from(4).unwrap(),
236        CustomDataTypeUInt4Element::try_from(5).unwrap(),
237    ];
238    array.store_chunk_elements(&[0, 0], &data).unwrap();
239
240    let data = array
241        .retrieve_array_subset_elements::<CustomDataTypeUInt4Element>(&array.subset_all())
242        .unwrap();
243
244    for f in &data {
245        println!("uint4: {:08b} u8: {}", f.as_u8(), f.as_u8());
246    }
247
248    assert_eq!(data[0], CustomDataTypeUInt4Element::try_from(1).unwrap());
249    assert_eq!(data[1], CustomDataTypeUInt4Element::try_from(2).unwrap());
250    assert_eq!(data[2], CustomDataTypeUInt4Element::try_from(3).unwrap());
251    assert_eq!(data[3], CustomDataTypeUInt4Element::try_from(4).unwrap());
252    assert_eq!(data[4], CustomDataTypeUInt4Element::try_from(5).unwrap());
253    assert_eq!(data[5], CustomDataTypeUInt4Element::try_from(15).unwrap());
254
255    let data = array
256        .retrieve_array_subset_elements::<CustomDataTypeUInt4Element>(
257            &ArraySubset::new_with_ranges(&[1..3, 0..1]),
258        )
259        .unwrap();
260    assert_eq!(data[0], CustomDataTypeUInt4Element::try_from(2).unwrap());
261    assert_eq!(data[1], CustomDataTypeUInt4Element::try_from(3).unwrap());
262}
examples/rectangular_array_write_read.rs (line 70)
8fn rectangular_array_write_read() -> Result<(), Box<dyn std::error::Error>> {
9    use rayon::prelude::{IntoParallelIterator, ParallelIterator};
10    use zarrs::array::ChunkGrid;
11    use zarrs::{
12        array::{chunk_grid::RectangularChunkGrid, codec, FillValue},
13        node::Node,
14    };
15    use zarrs::{
16        array::{DataType, ZARR_NAN_F32},
17        array_subset::ArraySubset,
18        storage::store,
19    };
20
21    // Create a store
22    // let path = tempfile::TempDir::new()?;
23    // let mut store: ReadableWritableListableStorage =
24    //     Arc::new(zarrs::filesystem::FilesystemStore::new(path.path())?);
25    let mut store: ReadableWritableListableStorage = Arc::new(store::MemoryStore::new());
26    if let Some(arg1) = std::env::args().collect::<Vec<_>>().get(1) {
27        if arg1 == "--usage-log" {
28            let log_writer = Arc::new(std::sync::Mutex::new(
29                // std::io::BufWriter::new(
30                std::io::stdout(),
31                //    )
32            ));
33            store = Arc::new(UsageLogStorageAdapter::new(store, log_writer, || {
34                chrono::Utc::now().format("[%T%.3f] ").to_string()
35            }));
36        }
37    }
38
39    // Create the root group
40    zarrs::group::GroupBuilder::new()
41        .build(store.clone(), "/")?
42        .store_metadata()?;
43
44    // Create a group with attributes
45    let group_path = "/group";
46    let mut group = zarrs::group::GroupBuilder::new().build(store.clone(), group_path)?;
47    group
48        .attributes_mut()
49        .insert("foo".into(), serde_json::Value::String("bar".into()));
50    group.store_metadata()?;
51
52    println!(
53        "The group metadata is:\n{}\n",
54        group.metadata().to_string_pretty()
55    );
56
57    // Create an array
58    let array_path = "/group/array";
59    let array = zarrs::array::ArrayBuilder::new(
60        vec![8, 8], // array shape
61        DataType::Float32,
62        ChunkGrid::new(RectangularChunkGrid::new(&[
63            [1, 2, 3, 2].try_into()?,
64            4.try_into()?,
65        ])),
66        FillValue::from(ZARR_NAN_F32),
67    )
68    .bytes_to_bytes_codecs(vec![
69        #[cfg(feature = "gzip")]
70        Arc::new(codec::GzipCodec::new(5)?),
71    ])
72    .dimension_names(["y", "x"].into())
73    // .storage_transformers(vec![].into())
74    .build(store.clone(), array_path)?;
75
76    // Write array metadata to store
77    array.store_metadata()?;
78
79    // Write some chunks (in parallel)
80    (0..4).into_par_iter().try_for_each(|i| {
81        let chunk_grid = array.chunk_grid();
82        let chunk_indices = vec![i, 0];
83        if let Some(chunk_shape) = chunk_grid.chunk_shape(&chunk_indices, array.shape())? {
84            let chunk_array = ndarray::ArrayD::<f32>::from_elem(
85                chunk_shape
86                    .iter()
87                    .map(|u| u.get() as usize)
88                    .collect::<Vec<_>>(),
89                i as f32,
90            );
91            array.store_chunk_ndarray(&chunk_indices, chunk_array)
92        } else {
93            Err(zarrs::array::ArrayError::InvalidChunkGridIndicesError(
94                chunk_indices.to_vec(),
95            ))
96        }
97    })?;
98
99    println!(
100        "The array metadata is:\n{}\n",
101        array.metadata().to_string_pretty()
102    );
103
104    // Write a subset spanning multiple chunks, including updating chunks already written
105    array.store_array_subset_ndarray(
106        &[3, 3], // start
107        ndarray::ArrayD::<f32>::from_shape_vec(
108            vec![3, 3],
109            vec![0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
110        )?,
111    )?;
112
113    // Store elements directly, in this case set the 7th column to 123.0
114    array.store_array_subset_elements::<f32>(
115        &ArraySubset::new_with_ranges(&[0..8, 6..7]),
116        &[123.0; 8],
117    )?;
118
119    // Store elements directly in a chunk, in this case set the last row of the bottom right chunk
120    array.store_chunk_subset_elements::<f32>(
121        // chunk indices
122        &[3, 1],
123        // subset within chunk
124        &ArraySubset::new_with_ranges(&[1..2, 0..4]),
125        &[-4.0; 4],
126    )?;
127
128    // Read the whole array
129    let data_all = array.retrieve_array_subset_ndarray::<f32>(&array.subset_all())?;
130    println!("The whole array is:\n{data_all}\n");
131
132    // Read a chunk back from the store
133    let chunk_indices = vec![1, 0];
134    let data_chunk = array.retrieve_chunk_ndarray::<f32>(&chunk_indices)?;
135    println!("Chunk [1,0] is:\n{data_chunk}\n");
136
137    // Read the central 4x2 subset of the array
138    let subset_4x2 = ArraySubset::new_with_ranges(&[2..6, 3..5]); // the center 4x2 region
139    let data_4x2 = array.retrieve_array_subset_ndarray::<f32>(&subset_4x2)?;
140    println!("The middle 4x2 subset is:\n{data_4x2}\n");
141
142    // Show the hierarchy
143    let node = Node::open(&store, "/").unwrap();
144    let tree = node.hierarchy_tree();
145    println!("The Zarr hierarchy tree is:\n{tree}");
146
147    Ok(())
148}
Source

pub fn new_with_configuration( configuration: &GzipCodecConfiguration, ) -> Result<Self, PluginCreateError>

Create a new gzip codec from configuration.

§Errors

Returns an error if the configuration is not supported.

Trait Implementations§

Source§

impl BytesToBytesCodecTraits for GzipCodec

Source§

fn into_dyn(self: Arc<Self>) -> Arc<dyn BytesToBytesCodecTraits>

Return a dynamic version of the codec.
Source§

fn recommended_concurrency( &self, _decoded_representation: &BytesRepresentation, ) -> Result<RecommendedConcurrency, CodecError>

Return the maximum internal concurrency supported for the requested decoded representation. Read more
Source§

fn encode<'a>( &self, decoded_value: RawBytes<'a>, _options: &CodecOptions, ) -> Result<RawBytes<'a>, CodecError>

Encode chunk bytes. Read more
Source§

fn decode<'a>( &self, encoded_value: RawBytes<'a>, _decoded_representation: &BytesRepresentation, _options: &CodecOptions, ) -> Result<RawBytes<'a>, CodecError>

Decode chunk bytes. Read more
Source§

fn encoded_representation( &self, decoded_representation: &BytesRepresentation, ) -> BytesRepresentation

Returns the size of the encoded representation given a size of the decoded representation.
Source§

fn partial_decoder( self: Arc<Self>, input_handle: Arc<dyn BytesPartialDecoderTraits>, decoded_representation: &BytesRepresentation, options: &CodecOptions, ) -> Result<Arc<dyn BytesPartialDecoderTraits>, CodecError>

Initialises a partial decoder. Read more
Source§

fn partial_encoder( self: Arc<Self>, input_handle: Arc<dyn BytesPartialDecoderTraits>, output_handle: Arc<dyn BytesPartialEncoderTraits>, decoded_representation: &BytesRepresentation, options: &CodecOptions, ) -> Result<Arc<dyn BytesPartialEncoderTraits>, CodecError>

Initialise a partial encoder. Read more
Source§

fn async_partial_decoder<'life0, 'life1, 'async_trait>( self: Arc<Self>, input_handle: Arc<dyn AsyncBytesPartialDecoderTraits>, decoded_representation: &'life0 BytesRepresentation, options: &'life1 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn AsyncBytesPartialDecoderTraits>, CodecError>> + Send + 'async_trait>>
where Self: Sync + Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Available on crate feature async only.
Initialises an asynchronous partial decoder. Read more
Source§

fn async_partial_encoder<'life0, 'life1, 'async_trait>( self: Arc<Self>, input_handle: Arc<dyn AsyncBytesPartialDecoderTraits>, output_handle: Arc<dyn AsyncBytesPartialEncoderTraits>, decoded_representation: &'life0 BytesRepresentation, options: &'life1 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn AsyncBytesPartialEncoderTraits>, CodecError>> + Send + 'async_trait>>
where Self: Sync + Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Available on crate feature async only.
Initialise an asynchronous partial encoder. Read more
Source§

impl Clone for GzipCodec

Source§

fn clone(&self) -> GzipCodec

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CodecTraits for GzipCodec

Source§

fn identifier(&self) -> &str

Unique identifier for the codec.
Source§

fn configuration_opt( &self, _name: &str, _options: &CodecMetadataOptions, ) -> Option<Configuration>

Create the codec configuration. Read more
Source§

fn partial_decoder_should_cache_input(&self) -> bool

Indicates if the input to a codecs partial decoder should be cached for optimal performance. If true, a cache may be inserted before it in a CodecChain partial decoder.
Source§

fn partial_decoder_decodes_all(&self) -> bool

Indicates if a partial decoder decodes all bytes from its input handle and its output should be cached for optimal performance. If true, a cache will be inserted at some point after it in a CodecChain partial decoder.
Source§

fn default_name(&self) -> String

The default name of the codec.
Source§

fn configuration(&self, name: &str) -> Option<Configuration>

Create the codec configuration with default options. Read more
Source§

impl Debug for GzipCodec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.