diff --git a/src/Database.zig b/src/Database.zig index 906d972..8ec6bdb 100644 --- a/src/Database.zig +++ b/src/Database.zig @@ -369,7 +369,9 @@ pub fn needsUpgrade(self: *const Database) bool { return c.notmuch_database_needs_upgrade(self.database) != 0; } -pub const UpgradeProgressNotifyCallback = fn (closure: ?*anyopaque, progress: f64) callconv(.c) void; +/// Callback function that provides progress notification during a database +/// upgrade operation. +pub const ProgressCallback = fn (closure: ?*anyopaque, progress: f64) callconv(.c) void; /// Upgrade the current database to the latest supported version. /// @@ -379,13 +381,13 @@ pub const UpgradeProgressNotifyCallback = fn (closure: ?*anyopaque, progress: f6 /// and if so, upgrade with this function before making any modifications. If /// `needsUpgrade` returns `false`, this will be a no-op. /// -/// The optional `progress_notify` callback can be used by the caller to +/// The optional `progress_cb` callback can be used by the caller to /// provide progress indication to the user. If non-`null` it will be called /// periodically with `progress` as a floating-point value in the range of [0.0 /// .. 1.0] indicating the progress made so far in the upgrade process. The /// argument `closure` is passed verbatim to any callback invoked. -pub fn upgrade(self: *const Database, progress_notify: ?UpgradeProgressNotifyCallback, closure: ?*anyopaque) Error!void { - try wrap(c.notmuch_database_upgrade(self.database, progress_notify, closure)); +pub fn upgrade(self: *const Database, progress_cb: ?ProgressCallback, closure: ?*anyopaque) Error!void { + try wrap(c.notmuch_database_upgrade(self.database, progress_cb, closure)); } /// Begin an atomic database operation. diff --git a/src/Query.zig b/src/Query.zig index 2f622e1..e3fac6c 100644 --- a/src/Query.zig +++ b/src/Query.zig @@ -7,16 +7,15 @@ const std = @import("std"); const c = @import("c"); -const status = @import("enums.zig").status; -const Error = @import("error.zig").Error; -const wrap = @import("error.zig").wrap; - -const Exclude = @import("enums.zig").Exclude; -const Sort = @import("enums.zig").Sort; +pub const Exclude = @import("enums.zig").Exclude; +pub const Sort = @import("enums.zig").Sort; const Database = @import("Database.zig"); +const Error = @import("error.zig").Error; const MessagesIterator = @import("MessagesIterator.zig"); +const status = @import("enums.zig").status; const ThreadsIterator = @import("ThreadsIterator.zig"); +const wrap = @import("error.zig").wrap; query: *c.notmuch_query_t, @@ -82,13 +81,6 @@ pub const AddTagExcludeError = error{ /// Add a tag that will be excluded from the query results by default. This /// exclusion will be ignored if this tag appears explicitly in the query. -/// -/// Errors returned: -/// -/// XapianException: a Xapian exception occurred. Most likely a problem lazily -/// parsing the query string. -/// -/// Ignored: tag is explicitly present in the query, so not excluded. pub fn addTagExclude(self: *const Query, tag: [:0]const u8) AddTagExcludeError!void { return switch (status(c.notmuch_query_add_tag_exclude(self.query, tag))) { .success => {}, diff --git a/src/notmuch.zig b/src/notmuch.zig index 53db2f0..b3368b2 100644 --- a/src/notmuch.zig +++ b/src/notmuch.zig @@ -21,7 +21,7 @@ pub const tag_max: usize = @intCast(c.NOTMUCH_TAG_MAX); const wrap = @import("error.zig").wrap; -/// Compact a notmuch database, backing up the original database to the given +/// Compact a `notmuch` database, backing up the original database to the given /// path. /// /// The database will be opened in read-write mode during the compaction process