@@ -1371,88 +1371,25 @@ impl Config {
13711371
13721372 /// Set a custom cache configuration.
13731373 ///
1374- /// If you want to load the cache configuration from a file, use [`Config::cache_config_load`]
1375- /// or [`Config::cache_config_load_default `] for the default enabled configuration.
1374+ /// If you want to load the cache configuration from a file, use [`CacheConfig::from_file`].
1375+ /// You can call [`CacheConfig::from_file(None) `] for the default, enabled configuration.
13761376 ///
1377- /// By default cache configuration is not enabled or loaded .
1377+ /// If you want to disable the cache, you can call this method with `None` .
13781378 ///
1379- /// This method is only available when the `cache` feature of this crate is
1380- /// enabled.
1381- ///
1382- /// [docs]: https://bytecodealliance.github.io/wasmtime/cli-cache.html
1383- #[ cfg( feature = "cache" ) ]
1384- pub fn cache_config ( & mut self , cache_config : CacheConfig ) -> & mut Self {
1385- self . cache_config = cache_config;
1386- self
1387- }
1388-
1389- /// Loads cache configuration specified at `path`.
1390- ///
1391- /// This method will read the file specified by `path` on the filesystem and
1392- /// attempt to load cache configuration from it. This method can also fail
1393- /// due to I/O errors, misconfiguration, syntax errors, etc. For expected
1394- /// syntax in the configuration file see the [documentation online][docs].
1395- ///
1396- /// By default cache configuration is not enabled or loaded.
1379+ /// By default, new configs do not have caching enabled.
1380+ /// Every call to [`Module::new(my_wasm)`][crate::Module::new] will recompile `my_wasm`,
1381+ /// even when it is unchanged, unless an enabled `CacheConfig` is provided.
13971382 ///
13981383 /// This method is only available when the `cache` feature of this crate is
13991384 /// enabled.
14001385 ///
1401- /// # Errors
1402- ///
1403- /// This method can fail due to any error that happens when loading the file
1404- /// pointed to by `path` and attempting to load the cache configuration.
1405- ///
14061386 /// [docs]: https://bytecodealliance.github.io/wasmtime/cli-cache.html
14071387 #[ cfg( feature = "cache" ) ]
1408- pub fn cache_config_load ( & mut self , path : impl AsRef < Path > ) -> Result < & mut Self > {
1409- self . cache_config = CacheConfig :: from_file ( Some ( path. as_ref ( ) ) ) ?;
1410- Ok ( self )
1411- }
1412-
1413- /// Disable caching.
1414- ///
1415- /// Every call to [`Module::new(my_wasm)`][crate::Module::new] will
1416- /// recompile `my_wasm`, even when it is unchanged.
1417- ///
1418- /// By default, new configs do not have caching enabled. This method is only
1419- /// useful for disabling a previous cache configuration.
1420- ///
1421- /// This method is only available when the `cache` feature of this crate is
1422- /// enabled.
1423- #[ cfg( feature = "cache" ) ]
1424- pub fn disable_cache ( & mut self ) -> & mut Self {
1425- self . cache_config = CacheConfig :: new_cache_disabled ( ) ;
1388+ pub fn cache_config ( & mut self , cache_config : Option < CacheConfig > ) -> & mut Self {
1389+ self . cache_config = cache_config. unwrap_or_else ( || CacheConfig :: new_cache_disabled ( ) ) ;
14261390 self
14271391 }
14281392
1429- /// Loads cache configuration from the system default path.
1430- ///
1431- /// This commit is the same as [`Config::cache_config_load`] except that it
1432- /// does not take a path argument and instead loads the default
1433- /// configuration present on the system. This is located, for example, on
1434- /// Unix at `$HOME/.config/wasmtime/config.toml` and is typically created
1435- /// with the `wasmtime config new` command.
1436- ///
1437- /// By default cache configuration is not enabled or loaded.
1438- ///
1439- /// This method is only available when the `cache` feature of this crate is
1440- /// enabled.
1441- ///
1442- /// # Errors
1443- ///
1444- /// This method can fail due to any error that happens when loading the
1445- /// default system configuration. Note that it is not an error if the
1446- /// default config file does not exist, in which case the default settings
1447- /// for an enabled cache are applied.
1448- ///
1449- /// [docs]: https://bytecodealliance.github.io/wasmtime/cli-cache.html
1450- #[ cfg( feature = "cache" ) ]
1451- pub fn cache_config_load_default ( & mut self ) -> Result < & mut Self > {
1452- self . cache_config = CacheConfig :: from_file ( None ) ?;
1453- Ok ( self )
1454- }
1455-
14561393 /// Sets a custom memory creator.
14571394 ///
14581395 /// Custom memory creators are used when creating host `Memory` objects or when
0 commit comments