Module v.vmod stdlib

v.vmod
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
1
Imported by:
5
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

  • Standard Library

Imported by

Aliases

This section is empty.

Constants

This section is empty.

Sum types

This section is empty.

Functions

#fn decode

fn decode(contents string) !Manifest

#fn from_file

fn from_file(vmod_path string) !Manifest

#fn get_cache

fn get_cache() &ModFileCacher

Structs

#struct Manifest

pub struct Manifest {
pub mut:
	name         string
	version      string
	description  string
	dependencies []string
	license      string
	repo_url     string
	author       string
	unknown      map[string][]string
}

#struct ModFileAndFolder

pub struct ModFileAndFolder {
pub:
	// vmod_file contains the full path of the found 'v.mod' file, or ''
	// if no 'v.mod' file was found in file_path_dir, or in its parent folders.
	vmod_file string
	// vmod_folder contains the file_path_dir, if there is no 'v.mod' file in
	// *any* of the parent folders, otherwise it is the first parent folder,
	// where a v.mod file was found.
	vmod_folder string
}

This file provides a caching mechanism for seeking quickly whether a given folder has a v.mod file in it or in any of its parent folders.

ModFileCacher.get(folder) works in such a way, that given this tree:

examples/hanoi.v vlib/v.mod vlib/v/tests/project_with_c_code/mod1/v.mod vlib/v/tests/project_with_c_code/mod1/wrapper.v

ModFileCacher.get('examples') => ModFileAndFolder{'', 'examples'} ModFileCacher.get('vlib/v/tests') => ModFileAndFolder{'vlib/v.mod', 'vlib'} ModFileCacher.get('vlib/v') => ModFileAndFolder{'vlib/v.mod', 'vlib'} ModFileCacher.get('vlib/v/test/project_with_c_code/mod1') => ModFileAndFolder{'vlib/v/test/project_with_c_code/mod1/v.mod', 'vlib/v/test/project_with_c_code/mod1'}

#struct ModFileCacher

heap
pub struct ModFileCacher {
mut:
	cache map[string]ModFileAndFolder
	// folder_files caches os.ls(key)
	folder_files map[string][]string
}

#fn new_mod_file_cacher

fn new_mod_file_cacher() &ModFileCacher

#fn (&ModFileCacher) debug

fn (mcache &ModFileCacher) debug()

#fn (&ModFileCacher) get_by_file

fn (mut mcache &ModFileCacher) get_by_file(vfile string) ModFileAndFolder

#fn (&ModFileCacher) get_by_folder

fn (mut mcache &ModFileCacher) get_by_folder(vfolder string) ModFileAndFolder

fn (mut cacher &ModFileCacher) add(path string, result ModFileAndFolder)

#fn (&ModFileCacher) traverse

fn (mut mcache &ModFileCacher) traverse(mfolder string) ([]string, ModFileAndFolder)

#fn (&ModFileCacher) mark_folders_with_vmod

fn (mut mcache &ModFileCacher) mark_folders_with_vmod(folders_so_far []string, vmod ModFileAndFolder)

#fn (&ModFileCacher) mark_folders_as_vmod_free

fn (mut mcache &ModFileCacher) mark_folders_as_vmod_free(folders_so_far []string)

#fn (&ModFileCacher) check_for_stop

fn (mcache &ModFileCacher) check_for_stop(cfolder string, files []string) bool

#fn (&ModFileCacher) get_files

fn (mut mcache &ModFileCacher) get_files(cfolder string) []string

Interfaces

This section is empty.

Enums

This section is empty.