Skip to content

Commit

Permalink
add doctest links
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Apr 5, 2023
1 parent 07269e5 commit 39981c2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src-rs/types/array.rs
Expand Up @@ -35,7 +35,7 @@ pub struct SRArrayImpl<T> {
///
/// assert_eq!(array.as_slice(), &[1, 2, 3])
/// ```
/// [_corresponding Swift code_]()
/// [_corresponding Swift code_](https://github.com/Brendonovich/swift-rs/blob/07269e511f1afb71e2fcfa89ca5d7338bceb20e8/tests/swift-pkg/doctests.swift#L19)
///
/// ## Returning in a Struct fIeld
///
Expand All @@ -58,7 +58,7 @@ pub struct SRArrayImpl<T> {
///
/// assert_eq!(data.array.as_slice(), &[4, 5, 6]);
/// ```
/// [_corresponding Swift code_]()
/// [_corresponding Swift code_](https://github.com/Brendonovich/swift-rs/blob/07269e511f1afb71e2fcfa89ca5d7338bceb20e8/tests/swift-pkg/doctests.swift#L32)
#[repr(transparent)]
pub struct SRArray<T>(SRObject<SRArrayImpl<T>>);

Expand Down
7 changes: 6 additions & 1 deletion src-rs/types/data.rs
Expand Up @@ -21,14 +21,19 @@ type Data = SRArray<u8>;
///
/// assert_eq!(data.as_ref(), &[1, 2, 3])
/// ```
/// [_corresponding Swift code_]()
/// [_corresponding Swift code_](https://github.com/Brendonovich/swift-rs/blob/07269e511f1afb71e2fcfa89ca5d7338bceb20e8/tests/swift-pkg/doctests.swift#L68)
#[repr(transparent)]
pub struct SRData(SRObject<Data>);

impl SRData {
///
pub fn as_slice(&self) -> &[u8] {
self
}

pub fn to_vec(&self) -> Vec<u8> {
self.as_slice().to_vec()
}
}

impl SwiftObject for SRData {
Expand Down
2 changes: 1 addition & 1 deletion src-rs/types/object.rs
Expand Up @@ -29,7 +29,7 @@ pub struct SRObjectImpl<T> {
///
/// let reference: &CustomObject = value.as_ref();
/// ```
/// [_corresponding Swift code_]()
/// [_corresponding Swift code_](https://github.com/Brendonovich/swift-rs/blob/07269e511f1afb71e2fcfa89ca5d7338bceb20e8/tests/swift-pkg/doctests.swift#L49)
#[repr(transparent)]
pub struct SRObject<T>(pub(crate) NonNull<SRObjectImpl<T>>);

Expand Down
2 changes: 1 addition & 1 deletion src-rs/types/string.rs
Expand Up @@ -19,7 +19,7 @@ use crate::{
///
/// assert_eq!(greeting.as_str(), "Hello Brendan!");
/// ```
/// [_corresponding Swift code_]()
/// [_corresponding Swift code_](https://github.com/Brendonovich/swift-rs/blob/07269e511f1afb71e2fcfa89ca5d7338bceb20e8/tests/swift-pkg/doctests.swift#L56)
#[repr(transparent)]
pub struct SRString(SRData);

Expand Down

0 comments on commit 39981c2

Please sign in to comment.