diff --git a/src/command_buffer.rs b/src/command_buffer.rs index 24d0768..e81d3c7 100644 --- a/src/command_buffer.rs +++ b/src/command_buffer.rs @@ -40,7 +40,8 @@ use libc::{c_void, size_t}; use std::mem; use std::ptr; -/// An OpenCL command-buffer. +/// An OpenCL command-buffer. +/// /// This extension adds the ability to record and replay buffers of OpenCL commands. /// See [cl_khr_command_buffer](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_command_buffer) #[derive(Debug)] diff --git a/src/command_queue.rs b/src/command_queue.rs index f06cd7d..977059d 100644 --- a/src/command_queue.rs +++ b/src/command_queue.rs @@ -42,7 +42,8 @@ use libc::{c_char, c_void, size_t}; use std::mem; use std::ptr; -/// An OpenCL command-queue. +/// An OpenCL command-queue. +/// /// Operations on OpenCL memory and kernel objects are performed using a /// command-queue. #[derive(Debug)] @@ -85,14 +86,15 @@ impl CommandQueue { self.max_work_item_dimensions } - /// Create an OpenCL command-queue on a specific device. + /// Create an OpenCL command-queue on a specific device. + /// /// Queries the device the max_work_item_dimensions. /// Deprecated in CL_VERSION_2_0 by create_command_queue_with_properties. /// /// * `context` - a valid OpenCL context. /// * `device_id` - a device or sub-device associated with context. /// * `properties` - a list of properties for the command-queue, see - /// [cl_command_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#legacy-queue-properties-table). + /// [cl_command_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#legacy-queue-properties-table). /// /// returns a Result containing the new CommandQueue /// or the error code from the OpenCL C API function. @@ -130,7 +132,7 @@ impl CommandQueue { /// /// * `context` - a valid OpenCL context. /// * `properties` - a list of properties for the command-queue, see - /// [cl_command_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#legacy-queue-properties-table). + /// [cl_command_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#legacy-queue-properties-table). /// /// returns a Result containing the new CommandQueue /// or the error code from the OpenCL C API function. @@ -161,7 +163,7 @@ impl CommandQueue { /// * `context` - a valid OpenCL context. /// * `device_id` - a device or sub-device associated with context. /// * `properties` - a null terminated list of properties for the command-queue, see - /// [cl_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#queue-properties-table). + /// [cl_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#queue-properties-table). /// /// returns a Result containing the new CommandQueue /// or the error code from the OpenCL C API function. @@ -206,7 +208,7 @@ impl CommandQueue { /// /// * `context` - a valid OpenCL context. /// * `properties` - a null terminated list of properties for the command-queue, see - /// [cl_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#queue-properties-table). + /// [cl_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#queue-properties-table). /// /// returns a Result containing the new CommandQueue /// or the error code from the OpenCL C API function. diff --git a/src/context.rs b/src/context.rs index 47fa8f0..ed50155 100644 --- a/src/context.rs +++ b/src/context.rs @@ -126,7 +126,7 @@ impl Context { /// /// * `devices` - a slice of cl_device_ids for an OpenCL Platform. /// * `properties` - a null terminated list of cl_context_properties, see - /// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table). + /// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table). /// * `pfn_notify` - an optional callback function that can be registered by the application. /// * `user_data` - passed as the user_data argument when pfn_notify is called. /// @@ -163,7 +163,7 @@ impl Context { /// /// * `devices` - a slice of SubDevices for an OpenCL Platform. /// * `properties` - a null terminated list of cl_context_properties, see - /// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table). + /// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table). /// * `pfn_notify` - an optional callback function that can be registered by the application. /// * `user_data` - passed as the user_data argument when pfn_notify is called. /// @@ -187,7 +187,7 @@ impl Context { /// /// * `device_type` - the cl_device_type to create a Context for. /// * `properties` - a null terminated list of cl_context_properties, see - /// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table). + /// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table). /// * `pfn_notify` - an optional callback function that can be registered by the application. /// * `user_data` - passed as the user_data argument when pfn_notify is called. /// @@ -230,12 +230,13 @@ impl Context { } /// Get the list of image formats supported by the Context for an image type, - /// and allocation information. + /// and allocation information. + /// /// Calls clGetSupportedImageFormats to get the desired information about the context. /// /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `image_type` - describes the image type. /// /// returns a Result containing the desired information in an InfoType enum diff --git a/src/device.rs b/src/device.rs index 7bab287..692e31d 100644 --- a/src/device.rs +++ b/src/device.rs @@ -80,7 +80,8 @@ impl SubDevice { } } -/// An OpenCL device id and methods to query it. +/// An OpenCL device id and methods to query it. +/// /// The query methods calls clGetDeviceInfo with the relevant param_name, see: /// [Device Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#device-queries-table). #[derive(Copy, Clone, Debug)] @@ -118,7 +119,7 @@ impl Device { /// Create sub-devices by partitioning an OpenCL device. /// /// * `properties` - the slice of cl_device_partition_property, see - /// [Subdevice Partition](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#subdevice-partition-table). + /// [Subdevice Partition](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#subdevice-partition-table). /// /// returns a Result containing a vector of available SubDevices /// or the error code from the OpenCL C API function. diff --git a/src/event.rs b/src/event.rs index 5e42763..cc6926c 100644 --- a/src/event.rs +++ b/src/event.rs @@ -17,7 +17,8 @@ pub use cl3::event::*; use super::Result; use libc::c_void; -/// An OpenCL event object. +/// An OpenCL event object. +/// /// Has methods to return information from calls to clGetEventInfo and /// clGetEventProfilingInfo with the appropriate parameters. /// Implements the Drop trait to call release_event when the object is dropped. diff --git a/src/kernel.rs b/src/kernel.rs index cd1b18b..425f5dd 100644 --- a/src/kernel.rs +++ b/src/kernel.rs @@ -148,7 +148,7 @@ impl Kernel { /// Pass additional information other than argument values to a kernel. /// /// * `param_name` - the information to be passed to kernel, see: - /// [Kernel Execution Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#kernel-exec-info-table). + /// [Kernel Execution Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#kernel-exec-info-table). /// * `param_ptr` - pointer to the data for the param_name. /// /// returns an empty Result or the error code from the OpenCL C API function. @@ -322,8 +322,9 @@ pub fn create_program_kernels(program: &Program) -> Result> { .collect::>()) } -/// A struct that implements the [builder pattern](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html) -/// to simplify setting up [Kernel] arguments and the [NDRange](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#_mapping_work_items_onto_an_ndrange) +/// A struct that implements the [builder pattern](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html). +/// +/// To simplify setting up [Kernel] arguments and the [NDRange](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#_mapping_work_items_onto_an_ndrange) /// when enqueueing a [Kernel] on a [CommandQueue]. #[derive(Debug)] pub struct ExecuteKernel<'a> { @@ -338,7 +339,7 @@ pub struct ExecuteKernel<'a> { } impl<'a> ExecuteKernel<'a> { - pub fn new(kernel: &'a Kernel) -> ExecuteKernel { + pub fn new(kernel: &'a Kernel) -> Self { ExecuteKernel { kernel, num_args: kernel @@ -454,7 +455,7 @@ impl<'a> ExecuteKernel<'a> { /// Pass additional information other than argument values to a kernel. /// /// * `param_name` - the information to be passed to kernel, see: - /// [Kernel Execution Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#kernel-exec-info-table). + /// [Kernel Execution Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#kernel-exec-info-table). /// * `param_ptr` - pointer to the data for the param_name. /// /// returns a reference to self. @@ -637,9 +638,9 @@ impl<'a> ExecuteKernel<'a> { /// * no global_work_sizes have been set /// * too many global_work_sizes have been set /// * global_work_offsets have been set and their dimensions do not match - /// global_work_sizes + /// global_work_sizes /// * local_work_sizes have been set and their dimensions do not match - /// global_work_sizes + /// global_work_sizes /// /// * `queue` - the [CommandQueue] to enqueue the [Kernel] on. /// diff --git a/src/lib.rs b/src/lib.rs index 1de2a04..079fc93 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,42 +52,42 @@ //! considers OpenCL as four models: //! //! * **Platform Model** -//! The physical OpenCL hardware: a *host* containing one or more OpenCL [platform]s, -//! each connected to one or more OpenCL [device]s. -//! An OpenCL application running on the *host*, creates an OpenCL environment -//! called a [context] on a single [platform] to process data on one or more -//! of the OpenCL [device]s connected to the [platform]. +//! The physical OpenCL hardware: a *host* containing one or more OpenCL [platform]s, +//! each connected to one or more OpenCL [device]s. +//! An OpenCL application running on the *host*, creates an OpenCL environment +//! called a [context] on a single [platform] to process data on one or more +//! of the OpenCL [device]s connected to the [platform]. //! //! * **Programming Model** -//! An OpenCL [program] consists of OpenCL [kernel] functions that can run -//! on OpenCL [device]s within a [context]. -//! OpenCL [program]s must be created (and most must be built) for a [context] -//! before their OpenCL [kernel] functions can be created from them, -//! the exception being "built-in" [kernel]s which don't need to be built -//! (or compiled and linked). -//! OpenCL [kernel]s are controlled by an OpenCL application that runs on the -//! *host*, see **Execution Model**. +//! An OpenCL [program] consists of OpenCL [kernel] functions that can run +//! on OpenCL [device]s within a [context]. +//! OpenCL [program]s must be created (and most must be built) for a [context] +//! before their OpenCL [kernel] functions can be created from them, +//! the exception being "built-in" [kernel]s which don't need to be built +//! (or compiled and linked). +//! OpenCL [kernel]s are controlled by an OpenCL application that runs on the +//! *host*, see **Execution Model**. //! //! * **Memory Model** -//! **OpenCL 1.2** memory is divided into two fundamental memory regions: -//! **host memory** and **device memory**. -//! OpenCL [kernel]s run on **device memory**; an OpenCL application must write -//! **host memory** to **device memory** for OpenCL [kernel]s to process. -//! An OpenCL application must also read results from **device memory** to -//! **host memory** after a [kernel] has completed execution. -//! **OpenCL 2.0** shared virtual memory ([svm]) is shared between the host -//! and device(s) and synchronised by OpenCL; eliminating the explicit transfer -//! of memory between host and device(s) memory regions. +//! **OpenCL 1.2** memory is divided into two fundamental memory regions: +//! **host memory** and **device memory**. +//! OpenCL [kernel]s run on **device memory**; an OpenCL application must write +//! **host memory** to **device memory** for OpenCL [kernel]s to process. +//! An OpenCL application must also read results from **device memory** to +//! **host memory** after a [kernel] has completed execution. +//! **OpenCL 2.0** shared virtual memory ([svm]) is shared between the host +//! and device(s) and synchronised by OpenCL; eliminating the explicit transfer +//! of memory between host and device(s) memory regions. //! //! * **Execution Model** -//! An OpenCL application creates at least one OpenCL [command_queue] for each -//! OpenCL [device] (or *sub-device*) within it's OpenCL [context]. -//! OpenCL [kernel] executions and **OpenCL 1.2** memory reads and writes are -//! "enqueued" by the OpenCL application on each [command_queue]. -//! An application can wait for all "enqueued" commands to finish on a -//! [command_queue] or it can wait for specific [event]s to complete. -//! Normally [command_queue]s run commands in the order that they are given. -//! However, [event]s can be used to execute [kernel]s out-of-order. +//! An OpenCL application creates at least one OpenCL [command_queue] for each +//! OpenCL [device] (or *sub-device*) within it's OpenCL [context]. +//! OpenCL [kernel] executions and **OpenCL 1.2** memory reads and writes are +//! "enqueued" by the OpenCL application on each [command_queue]. +//! An application can wait for all "enqueued" commands to finish on a +//! [command_queue] or it can wait for specific [event]s to complete. +//! Normally [command_queue]s run commands in the order that they are given. +//! However, [event]s can be used to execute [kernel]s out-of-order. //! //! # OpenCL Objects //! diff --git a/src/memory.rs b/src/memory.rs index b5b8a3d..40f1500 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -108,7 +108,8 @@ pub trait ClMem { } } -/// An OpenCL buffer. +/// An OpenCL buffer. +/// /// Implements the Drop trait to call release_mem_object when the object is dropped. #[derive(Debug)] pub struct Buffer { @@ -154,11 +155,11 @@ impl Buffer { /// /// * `context` - a valid OpenCL context. /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `count` - the number of T objects to be allocated. /// * `host_ptr` - a pointer to the buffer data that may already be allocated - /// by the application. + /// by the application. /// /// returns a Result containing the new OpenCL buffer object /// or the error code from the OpenCL C API function. @@ -173,17 +174,18 @@ impl Buffer { Ok(Self::new(buffer)) } - /// Create an OpenCL buffer object for a context. + /// Create an OpenCL buffer object for a context. + /// /// CL_VERSION_3_0 /// /// * `context` - a valid OpenCL context. /// * `properties` - an optional null terminated list of properties. /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `count` - the number of T objects to be allocated. /// * `host_ptr` - a pointer to the buffer data that may already be allocated - /// by the application. + /// by the application. /// /// returns a Result containing the new OpenCL buffer object /// or the error code from the OpenCL C API function. @@ -209,8 +211,8 @@ impl Buffer { /// /// * `context` - a valid OpenCL context created from an OpenGL context. /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `bufobj` - the OpenGL buffer. /// /// returns a Result containing the new OpenCL buffer object @@ -242,12 +244,13 @@ impl Buffer { Ok(Self::new(buffer)) } - /// Create an new OpenCL buffer object from an existing buffer object. + /// Create an new OpenCL buffer object from an existing buffer object. + /// /// See: [SubBuffer Attributes](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#subbuffer-create-info-table). /// /// * `flags` - a bit-field used to specify allocation and usage information - /// about the sub-buffer memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the sub-buffer memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `origin` - the offset in number of objects of type . /// * `count` - the size of the sub-buffer in number of objects of type . /// @@ -273,7 +276,8 @@ impl Buffer { } } -/// An OpenCL image. +/// An OpenCL image. +/// /// Has methods to return information from calls to clGetImageInfo with the /// appropriate parameters. /// Implements the Drop trait to call release_mem_object when the object is dropped. @@ -315,14 +319,14 @@ impl Image { /// /// * `context` - a valid OpenCL context. /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `image_format` - a pointer to a structure that describes format properties - /// of the image to be allocated. + /// of the image to be allocated. /// * `image_desc` - a pointer to a structure that describes type and dimensions - /// of the image to be allocated. + /// of the image to be allocated. /// * `host_ptr` - a pointer to the image data that may already be allocated - /// by the application. + /// by the application. /// /// returns a Result containing the new OpenCL image object /// or the error code from the OpenCL C API function. @@ -338,20 +342,21 @@ impl Image { Ok(Self::new(image)) } - /// Create an OpenCL image object for a context. + /// Create an OpenCL image object for a context. + /// /// CL_VERSION_3_0 /// /// * `context` - a valid OpenCL context. /// * `properties` - an optional null terminated list of properties. /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `image_format` - a pointer to a structure that describes format properties - /// of the image to be allocated. + /// of the image to be allocated. /// * `image_desc` - a pointer to a structure that describes type and dimensions - /// of the image to be allocated. + /// of the image to be allocated. /// * `host_ptr` - a pointer to the image data that may already be allocated - /// by the application. + /// by the application. /// /// returns a Result containing the new OpenCL image object /// or the error code from the OpenCL C API function. @@ -376,13 +381,15 @@ impl Image { } /// Create an OpenCL image object, image array object, or image buffer object - /// for a context from an OpenGL texture object, texture array object, - /// texture buffer object, or a single face of an OpenGL cubemap texture object. + /// for a context. + /// + /// From an OpenGL: texture object, texture array object, texture buffer object, + /// or a single face of an OpenGL cubemap texture object. /// /// * `context` - a valid OpenCL context created from an OpenGL context. /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `texture_target` - used to define the image type of texture. /// * `miplevel ` - used to define the mipmap level. /// * `texture ` - the name of a GL buffer texture object. @@ -405,8 +412,8 @@ impl Image { /// /// * `context` - a valid OpenCL context created from an OpenGL context. /// * `flags` - a bit-field used to specify allocation and usage information - /// about the image memory object being created, see: - /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). + /// about the image memory object being created, see: + /// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table). /// * `renderbuffer` - a GL renderbuffer object. /// /// returns a Result containing the new OpenCL image object @@ -428,7 +435,7 @@ impl Image { /// * `image` - should be of type EGLImageKHR, cast into the type CLeglImageKHR. /// * `flags` - usage information about the memory object being created. /// * `properties` - a null terminated list of property names and their - /// corresponding values. + /// corresponding values. /// /// returns a Result containing the new OpenCL image object /// or the error code from the OpenCL C API function. diff --git a/src/platform.rs b/src/platform.rs index 9168316..3ca9543 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -32,7 +32,8 @@ use cl3::types::{ #[allow(unused_imports)] use libc::{c_void, intptr_t}; -/// An OpenCL platform id and methods to query it. +/// An OpenCL platform id and methods to query it. +/// /// The query methods calls clGetPlatformInfo with the relevant param_name, see: /// [Platform Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#platform-queries-table). #[derive(Copy, Clone, Debug)] diff --git a/src/program.rs b/src/program.rs index a5e6499..f051bea 100644 --- a/src/program.rs +++ b/src/program.rs @@ -325,11 +325,12 @@ impl Program { /// Compile a program’s source for the devices the OpenCL context associated /// with the program. + /// /// * `devices` - a slice of devices that are in context. /// * `options` - the compilation options in a null-terminated string. /// * `input_headers` - a slice of programs that describe headers in the input_headers. /// * `header_include_names` - an array that has a one to one correspondence with - /// input_headers. + /// input_headers. /// /// returns a null Result /// or the error code from the OpenCL C API function. @@ -394,7 +395,7 @@ impl Program { /// * `spec_id` - the specialization constant whose value will be set. /// * `spec_size` - size in bytes of the data pointed to by spec_value. /// * `spec_value` - pointer to the memory location that contains the value - /// of the specialization constant. + /// of the specialization constant. /// /// returns an empty Result or the error code from the OpenCL C API function. #[cfg(feature = "CL_VERSION_2_2")] diff --git a/src/svm.rs b/src/svm.rs index 88bf72e..6d4ab07 100644 --- a/src/svm.rs +++ b/src/svm.rs @@ -151,7 +151,9 @@ impl<'a, T> SvmRawVec<'a, T> { alloc::dealloc(self.ptr.cast::(), layout); } } else { - unsafe { let _ = svm_free(self.context.get(), self.ptr.cast::()); }; + unsafe { + let _ = svm_free(self.context.get(), self.ptr.cast::()); + }; } } @@ -175,7 +177,9 @@ impl<'a, T> Drop for SvmRawVec<'a, T> { alloc::dealloc(self.ptr.cast::(), layout); } } else { - unsafe { let _ = svm_free(self.context.get(), self.ptr.cast::()); }; + unsafe { + let _ = svm_free(self.context.get(), self.ptr.cast::()); + }; } self.ptr = ptr::null_mut(); }