pub fn new<'py, T: 'static + Send + AssertNotZeroSized>(
        py: Python<'py>,
        value: T,
        name: &CStr,
    ) -> PyResult<&'py Self> {
        Self::new_with_destructor(py, value, name, |_, _| {})
    }
/// Constructs a new capsule whose contents are `value`, associated with `name`.
/// `name` is the identifier for the capsule; if it is stored as an attribute of a module,
/// the name should be in the format `"modulename.attribute"`.
///
/// It is checked at compile time that the type T is not zero-sized. Rust function items
/// need to be cast to a function pointer (`fn(args) -> result`) to be put into a capsule.
///
/// # Example
///
/// ```
/// use pyo3::{prelude::*, types::PyCapsule};
/// use std::ffi::CString;
///
/// Python::with_gil(|py| {
///     let name = CString::new("foo").unwrap();
///     let capsule = PyCapsule::new(py, 123_u32, &name).unwrap();
///     let val = unsafe { capsule.reference::<u32>() };
///     assert_eq!(*val, 123);
/// });
/// ```
///
/// However, attempting to construct a `PyCapsule` with a zero-sized type will not compile:
///
/// ```compile_fail
/// use pyo3::{prelude::*, types::PyCapsule};
/// use std::ffi::CString;
///
/// Python::with_gil(|py| {
///     let name = CString::new("foo").unwrap();
///     let capsule = PyCapsule::new(py, (), &name).unwrap();  // Oops! `()` is zero sized!
/// });
/// ```
Constructs a new capsule whose contents are `value`, associated with `name`.
`name` is the identifier for the capsule; if it is stored as an attribute of a module,
the name should be in the format `"modulename.attribute"`.

It is checked at compile time that the type T is not zero-sized. Rust function items
need to be cast to a function pointer (`fn(args) -> result`) to be put into a capsule.
Constructs a new capsule whose contents are ` value ` associated with ` name ` . ` name ` is the identifier for the capsule ; if it is stored as an attribute of a module the name should be in the format ` " modulename . attribute " ` . It is checked at compile time that the type T is not zero - sized . Rust function items need to be cast to a function pointer ( ` fn ( args ) - > result ` ) to be put into a capsule .
pub fn new<'py, T: 'static + Send + AssertNotZeroSized>(
        py: Python<'py>,
        value: T,
        name: &CStr,
    ) -> PyResult<&'py Self> {
        Self::new_with_destructor(py, value, name, |_, _| {})
    }
pub fn new < ' py , T : ' static + Send + AssertNotZeroSized > ( py : Python < ' py > , value : T , name : & CStr , ) -> PyResult < & ' py Self > { Self :: new_with_destructor ( py , value , name , | _ , _ | { } ) }
Constructs a new capsule whose contents are `value`, associated with `name`.
Constructs a new capsule whose contents are ` value ` associated with ` name ` .
py
Python<'py>
value
T
name
&CStr
py
Python<'py>
value
T
name
&CStr
example
```
use pyo3::{prelude::*, types::PyCapsule};
use std::ffi::CString.



However, attempting to construct a `PyCapsule` with a zero-sized type will not compile.

```compile_fail
use pyo3::{prelude::*, types::PyCapsule};
use std::ffi::CString.

:with_gil(|py| {
let name = CString::new("foo").unwrap();
let capsule = PyCapsule::new(py, (), &name).unwrap();  // Oops. `()` is zero sized.
` ` ` use pyo3 :: { prelude :: * types :: PyCapsule } ; use std :: ffi :: CString . However attempting to construct a ` PyCapsule ` with a zero - sized type will not compile . ` ` ` compile_fail use pyo3 :: { prelude :: * types :: PyCapsule } ; use std :: ffi :: CString . : with_gil ( |py| { let name = CString :: new ( " foo " ) . unwrap () ; let capsule = PyCapsule :: new ( py () &name ) . unwrap () ; // Oops . ` () ` is zero sized .