XU XUv0.8.8
中文

API

#testing/fstest

import: #testing/fstest

counts: 2 fns, 5 methods, 2 types, 0 consts, 0 ifaces

In-memory MapFS and a consistency check.

struct MapFile

XuAPI
pub struct MapFile {
    pub name string
    pub body string
    pub dir bool
}

Purpose

Public struct `MapFile`.

Parameters

name string
name
body string
body
dir bool
directory

struct MapFS

XuAPI
pub struct MapFS {
    pub files []MapFile
}

Purpose

Public struct `MapFS`.

Parameters

files []MapFile
field ([]MapFile)

map_fs

XuAPI
pub fn map_fs() MapFS

Purpose

Map fs.

Parameters

none

Returns

MapFS — a value of this type

(&mut MapFS) add

XuAPI
pub fn (fs &mut MapFS) add(name string, body string)

Purpose

Method on `&mut MapFS`: add.

Parameters

fs &mut MapFS
receiver &mut MapFS (exclusive borrow)
name string
name (string)
body string
body (string)

(&mut MapFS) add_dir

XuAPI
pub fn (fs &mut MapFS) add_dir(name string)

Purpose

Method on `&mut MapFS`: add directory.

Parameters

fs &mut MapFS
receiver &mut MapFS (exclusive borrow)
name string
name (string)

(MapFS) read_file

XuAPI
pub fn (fs MapFS) read_file(name string) string

Purpose

Method on `MapFS`: read file. Throws on failure.

Parameters

fs MapFS
receiver MapFS (value receiver)
name string
name (string)

Returns

string — result string

(MapFS) stat_dir

XuAPI
pub fn (fs MapFS) stat_dir(name string) bool

Purpose

Method on `MapFS`: stat directory.

Parameters

fs MapFS
receiver MapFS (value receiver)
name string
name (string)

Returns

bool — true or false

(MapFS) has

XuAPI
pub fn (fs MapFS) has(name string) bool

Purpose

Call `has` on `MapFS`.

Parameters

fs MapFS
receiver MapFS (value receiver)
name string
name (string)

Returns

bool — true or false

test

XuAPI
pub fn test(fs &MapFS) int

Purpose

test; returns int. Throws on failure.

Parameters

fs &MapFS
fs (borrowed; caller keeps it; type &MapFS)

Returns

int — a value of this type