vfs/directory/
traversal_position.rs

1// Copyright 2019 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5/// Seek position inside a directory.  The precise meaning of the Name and Index values are entirely
6/// up to an implementation; it could indicate the next entry to be returned or the last entry
7/// returned; the type should be considered to be opaque to the client.  There are some
8/// implementations that return entries in alphabetical order, but they are not required to do so.
9/// The Start value indicates the first entry should be returned and the End value indicates no more
10/// entries should be returned.
11#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
12pub enum TraversalPosition {
13    /// The first entry in the directory.
14    Start,
15    /// A name of an entry.
16    Name(String),
17    /// The index of an entry.
18    Index(u64),
19    /// The whole listing was traversed.  There is nothing else to return.
20    End,
21}
22
23/// The default value specifies a traversal that is positioned on the very first entry.
24impl Default for TraversalPosition {
25    fn default() -> Self {
26        TraversalPosition::Start
27    }
28}