just playing with tangled
at tmp-tutorial 50 lines 1.3 kB view raw
1// Copyright 2023 The Jujutsu Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15#![allow(missing_docs)] 16 17use std::path::{Path, PathBuf}; 18 19use crate::submodule_store::SubmoduleStore; 20 21#[derive(Debug)] 22pub struct DefaultSubmoduleStore { 23 #[allow(dead_code)] 24 path: PathBuf, 25} 26 27impl DefaultSubmoduleStore { 28 /// Load an existing SubmoduleStore 29 pub fn load(store_path: &Path) -> Self { 30 DefaultSubmoduleStore { 31 path: store_path.to_path_buf(), 32 } 33 } 34 35 pub fn init(store_path: &Path) -> Self { 36 DefaultSubmoduleStore { 37 path: store_path.to_path_buf(), 38 } 39 } 40 41 pub fn name() -> &'static str { 42 "default" 43 } 44} 45 46impl SubmoduleStore for DefaultSubmoduleStore { 47 fn name(&self) -> &str { 48 DefaultSubmoduleStore::name() 49 } 50}