Skip to content

Document C driver functions which consume the argument #801

@krishnangovindraj

Description

@krishnangovindraj

Problem to Solve

It's unclear to anyone consuming the c driver which non _drop functions consume the argument pointer.

Proposed Solution

It is quite obvious from the implementation of the functions in rust when the pointer is consumed (take_ownership). This can be added to the docstring.

/// Produces an <code>Iterator</code> over all JSON <code>ConceptDocument</code>s in this <code>QueryAnswer</code>.
+ Consumes the <code>QueryAnswer</code>.
#[no_mangle]
pub extern "C" fn query_answer_into_documents(query_answer: *mut QueryAnswer) -> *mut StringIterator {
    release(StringIterator(CIterator(box_stream(
        take_ownership(query_answer)
            .into_documents()
            .map(|result| result.map(|document| document.into_json().to_string())),
    ))))
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions