comment updates
This commit is contained in:
@@ -3,12 +3,9 @@ use crate::traits::*;
|
|||||||
use crate::util::{drop_pointer_array, vec_into_raw_parts};
|
use crate::util::{drop_pointer_array, vec_into_raw_parts};
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
/// TCStrings represents a list of tags associated with a task.
|
/// TCStrings represents a list of string.
|
||||||
///
|
///
|
||||||
/// The content of this struct must be treated as read-only.
|
/// The content of this struct must be treated as read-only.
|
||||||
///
|
|
||||||
/// The lifetime of a TCStrings instance is independent of the task, and it
|
|
||||||
/// will remain valid even if the task is freed.
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct TCStrings {
|
pub struct TCStrings {
|
||||||
/// number of tags in items
|
/// number of tags in items
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ use std::ptr::NonNull;
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use taskchampion::{Tag, Task, TaskMut};
|
use taskchampion::{Tag, Task, TaskMut};
|
||||||
|
|
||||||
// TODO: use NonNull more
|
|
||||||
|
|
||||||
/// A task, as publicly exposed by this library.
|
/// A task, as publicly exposed by this library.
|
||||||
///
|
///
|
||||||
/// A task begins in "immutable" mode. It must be converted to "mutable" mode
|
/// A task begins in "immutable" mode. It must be converted to "mutable" mode
|
||||||
@@ -301,9 +299,8 @@ pub extern "C" fn tc_task_is_active(task: *mut TCTask) -> bool {
|
|||||||
wrap(task, |task| task.is_active())
|
wrap(task, |task| task.is_active())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if a task has the given tag. If the tag is invalid, this function will simply return
|
/// Check if a task has the given tag. If the tag is invalid, this function will return false, as
|
||||||
/// false, with no error from `tc_task_error`.
|
/// that (invalid) tag is not present. No error will be reported via `tc_task_error`.
|
||||||
// TODO: why no error??
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn tc_task_has_tag<'a>(task: *mut TCTask, tag: *mut TCString) -> bool {
|
pub extern "C" fn tc_task_has_tag<'a>(task: *mut TCTask, tag: *mut TCString) -> bool {
|
||||||
// SAFETY: see TCString docstring
|
// SAFETY: see TCString docstring
|
||||||
@@ -317,7 +314,10 @@ pub extern "C" fn tc_task_has_tag<'a>(task: *mut TCTask, tag: *mut TCString) ->
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the tags for the task. The task must not be NULL.
|
/// Get the tags for the task.
|
||||||
|
///
|
||||||
|
/// The caller must free the returned TCStrings instance. The TCStrings instance does not
|
||||||
|
/// reference the task and the two may be freed in any order.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn tc_task_get_tags<'a>(task: *mut TCTask) -> TCStrings {
|
pub extern "C" fn tc_task_get_tags<'a>(task: *mut TCTask) -> TCStrings {
|
||||||
wrap(task, |task| {
|
wrap(task, |task| {
|
||||||
|
|||||||
Reference in New Issue
Block a user