Test post 1
Introduction
Hello and welcome to another issue of This Week in Rust! Rust is a programming language empowering everyone to build reliable and efficient software. This is a weekly summary of its progress and community. Want something mentioned? Tag us at @ThisWeekInRust on Twitter or @ThisWeekinRust on mastodon.social, or send us a pull request. Want to get involved? We love contributions.
This Week in Rust is openly developed on GitHub. If you find any errors in this week’s issue, please submit a PR.
Updates from Rust Community
Owl bet you'll lose this staring contest 🦉 pic.twitter.com/eJh4f2zncC
— San Diego Zoo Wildlife Alliance (@sandiegozoo) October 26, 2021
1// LoadFromPath загружает набор доступных типов контента из каталога path.
2// Допускается полностью переопределять тип с учетом разных версий. Эта функция рекурсивно обойдет
3// все подкаталоги, так что рекомендуется соблюдать иерархию файлов в каталоге с моделями,
4// например, размещать продуктовые конфигурации в отдельных каталогах.
5func LoadFromPath(path string) (*Models, error) {
6var m = Models{
7added: make(map[string]struct{}),
8}
9
10 singleCfgFile := filepath.Join(path, investigationSingleConfigFileName)
11
12 configStat, err := os.Stat(singleCfgFile)
13 switch {
14 case err == nil && configStat.IsDir():
15 return nil, errors.Errorf("initialization file %q must be a file, not directory", singleCfgFile)
16 case err == nil:
17 if err := m.loadAllFromFile(singleCfgFile); err != nil {
18 return nil, errors.WrapWithMessage(err, "cannot init data from single file")
19 }
20 case os.IsNotExist(err):
21 if err := m.explore(path); err != nil {
22 return nil, errors.WrapWithMessage(err, "cannot init data from dir")
23 }
24 default:
25 return nil, err
26 }
27
28 if len(m.ContentTypes) == 0 {
29 return nil, errors.New("no configuration files were found")
30 }
31 return &m, nil
32}
My Heading
Hello and welcome to another issue of This Week in Rust! Rust is a programming language empowering everyone to build reliable and efficient software. This is a weekly summary of its progress and community. Want something mentioned? Tag us at @ThisWeekInRust on Twitter or @ThisWeekinRust on mastodon.social, or send us a pull request. Want to get involved? We love contributions.
This Week in Rust is openly developed on GitHub. If you find any errors in this week’s issue, please submit a PR.
Updates from Rust Community
Hello and welcome to another issue of This Week in Rust! Rust is a programming language empowering everyone to build reliable and efficient software. This is a weekly summary of its progress and community. Want something mentioned? Tag us at @ThisWeekInRust on Twitter or @ThisWeekinRust on mastodon.social, or send us a pull request. Want to get involved? We love contributions.
This Week in Rust is openly developed on GitHub. If you find any errors in this week’s issue, please submit a PR.