Struct ptx_builder::reporter::CargoAdapter
source · pub struct CargoAdapter { /* private fields */ }
Expand description
Cargo integration adapter.
Provides PTX assembly path to Rust through specified environment variable name and informs Cargo about device crate dependencies, so it can rebuild on changes.
§Usage in build.rs
use ptx_builder::error::Result;
use ptx_builder::prelude::*;
fn main() -> Result<()> {
CargoAdapter::with_env_var("PTX_PATH").build(Builder::new(".")?);
}
Implementations§
source§impl CargoAdapter
impl CargoAdapter
sourcepub fn with_env_var<S: AsRef<str>>(env_name: S) -> Self
pub fn with_env_var<S: AsRef<str>>(env_name: S) -> Self
Creates an instance of the adapter that will provide PTX assembly path
to Rust via env_name
environment variable.
The PTX assembly can later be used in host crate:
ⓘ
use std::ffi::CString;
let ptx = CString::new(include_str!(env!("PTX_PATH")))?;
Auto Trait Implementations§
impl Freeze for CargoAdapter
impl RefUnwindSafe for CargoAdapter
impl Send for CargoAdapter
impl Sync for CargoAdapter
impl Unpin for CargoAdapter
impl UnwindSafe for CargoAdapter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more