1mod impls {
2 use std::ops::{Deref, DerefMut};
3
4 use crate::{File, State};
5
6 impl Deref for File {
7 type Target = State;
8
9 fn deref(&self) -> &Self::Target {
10 &self.state
11 }
12 }
13
14 impl DerefMut for File {
15 fn deref_mut(&mut self) -> &mut Self::Target {
16 &mut self.state
17 }
18 }
19}
20
21mod impl_ {
22 use std::fmt::Formatter;
23
24 use crate::{File, State};
25
26 impl std::fmt::Debug for File {
27 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
28 f.debug_struct("File")
29 .field("path", &self.path.display())
30 .field("checksum", &self.checksum)
31 .finish_non_exhaustive()
32 }
33 }
34
35 impl From<File> for State {
36 fn from(f: File) -> Self {
37 f.state
38 }
39 }
40}
41
42mod access {
43 use crate::File;
44
45 impl File {
47 pub fn into_parts(self) -> (crate::State, std::path::PathBuf) {
49 (self.state, self.path)
50 }
51 }
52
53 impl File {
55 pub fn path(&self) -> &std::path::Path {
57 &self.path
58 }
59
60 pub fn checksum(&self) -> Option<gix_hash::ObjectId> {
64 self.checksum
65 }
66 }
67}
68
69mod mutation {
70 use std::path::PathBuf;
71
72 use crate::File;
73
74 impl File {
76 pub fn set_path(&mut self, path: impl Into<PathBuf>) {
80 self.path = path.into();
81 }
82 }
83}
84
85pub mod init;
87pub mod verify;
89pub mod write;