Creates a new module from a PTX string, allocating an intermediate buffer for the [`CString`]. The driver will JIT the PTX into arch-specific cubin or pick already-cached cubin if available. # Panics Panics if `string` contains a nul. # Example ``` # use cust::*; # use std::error::Error; # fn main() -> Result<(), Box > { # let _ctx = quick_init()?; use cust::module::Module; let ptx
(string: T, options: &[ModuleJitOption])
| 284 | /// # } |
| 285 | /// ``` |
| 286 | pub fn from_ptx<T: AsRef<str>>(string: T, options: &[ModuleJitOption]) -> CudaResult<Module> { |
| 287 | let cstr = CString::new(string.as_ref()) |
| 288 | .expect("string given to Module::from_str contained nul bytes"); |
| 289 | Self::from_ptx_cstr(cstr.as_c_str(), options) |
| 290 | } |
| 291 | |
| 292 | /// Load a module from a normal (rust) string, implicitly making it into |
| 293 | /// a cstring. |