[][src]Struct ptx_builder::reporter::CargoAdapter

pub struct CargoAdapter { /* fields omitted */ }

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(".")?);
}

Methods

impl CargoAdapter[src]

pub fn with_env_var<S: AsRef<str>>(env_name: S) -> Self[src]

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:

This example is not tested
use std::ffi::CString;

let ptx = CString::new(include_str!(env!("PTX_PATH")))?;

pub fn build(&self, builder: Builder) -> ![src]

Runs build process and reports artifacts to Cargo.

Depends on whether the build was successful or not, will either call exit(0) or exit(1) and print error log to stderr.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]