summaryrefslogtreecommitdiff
path: root/src/generation.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-02-26 07:18:46 +0200
committerLars Wirzenius <liw@liw.fi>2022-03-03 18:54:32 +0200
commit83b83530c05e23945cfe5a11a2125c4d93d40a93 (patch)
tree59f2c38cd3e0214c3aea9b8f0b569193925dec25 /src/generation.rs
parentdd8ac8901cd15945bce8d1a072abbcbdfe6d5a83 (diff)
downloadobnam2-83b83530c05e23945cfe5a11a2125c4d93d40a93.tar.gz
refactor: use FileId instead of raw type
This is clearer and less error prone. Sponsored-by: author
Diffstat (limited to 'src/generation.rs')
-rw-r--r--src/generation.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/generation.rs b/src/generation.rs
index 454bb50..2a886ad 100644
--- a/src/generation.rs
+++ b/src/generation.rs
@@ -2,6 +2,7 @@
use crate::backup_reason::Reason;
use crate::chunkid::ChunkId;
+use crate::dbgen::FileId;
use crate::fsentry::FilesystemEntry;
use rusqlite::Connection;
use serde::Serialize;
@@ -15,9 +16,6 @@ const SCHEMA_MAJOR: u32 = 0;
/// Current generation database schema minor version.
const SCHEMA_MINOR: u32 = 0;
-/// An identifier for a file in a generation.
-type FileId = i64;
-
/// An identifier for a generation.
#[derive(Debug, Clone)]
pub struct GenId {
@@ -250,7 +248,7 @@ impl LocalGeneration {
}
/// How many files are there in the local generation?
- pub fn file_count(&self) -> Result<i64, LocalGenerationError> {
+ pub fn file_count(&self) -> Result<FileId, LocalGenerationError> {
sql::file_count(&self.conn)
}