From 259f1576c3cadc71059252160f6859edd8856d4a Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 7 Aug 2018 06:06:49 +0000 Subject: [PATCH] Fix tests after a74958f0. --- artiq/test/libartiq_support/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/artiq/test/libartiq_support/lib.rs b/artiq/test/libartiq_support/lib.rs index d9c609fe0..b3188e17a 100644 --- a/artiq/test/libartiq_support/lib.rs +++ b/artiq/test/libartiq_support/lib.rs @@ -34,6 +34,20 @@ mod cslice { } } } + + pub trait AsCSlice<'a, T> { + fn as_c_slice(&'a self) -> CSlice<'a, T>; + } + + impl<'a> AsCSlice<'a, u8> for str { + fn as_c_slice(&'a self) -> CSlice<'a, u8> { + CSlice { + base: self.as_ptr(), + len: self.len() as u32, + phantom: PhantomData + } + } + } } #[path = "../../firmware/ksupport/eh.rs"]