updatehub_package_schema/definitions/
filesystem.rs

1// Copyright (C) 2019 O.S. Systems Sofware LTDA
2//
3// SPDX-License-Identifier: Apache-2.0
4
5use serde::Deserialize;
6use std::fmt;
7
8/// Filesystem type that must be used to mount device.
9#[derive(Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
10#[serde(rename_all = "lowercase")]
11pub enum Filesystem {
12    Btrfs,
13    Ext2,
14    Ext3,
15    Ext4,
16    Vfat,
17    F2fs,
18    Jffs2,
19    Ubifs,
20    Xfs,
21}
22
23impl fmt::Display for Filesystem {
24    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25        fmt::Display::fmt(
26            match self {
27                Filesystem::Btrfs => "btrfs",
28                Filesystem::Ext2 => "ext2",
29                Filesystem::Ext3 => "ext3",
30                Filesystem::Ext4 => "ext4",
31                Filesystem::Vfat => "vfat",
32                Filesystem::F2fs => "f2fs",
33                Filesystem::Jffs2 => "jffs2",
34                Filesystem::Ubifs => "ubifs",
35                Filesystem::Xfs => "xfs",
36            },
37            f,
38        )
39    }
40}