Skip to content

Commit

Permalink
Merge branch 'enabled' of github.com:Dherse/comemo into enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Dherse committed Jul 7, 2024
2 parents a075754 + 927b373 commit 74c3fff
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,19 @@ use syn::{parse_quote, Error, Result};
/// }
/// ```
///
/// # Disabling memoization
/// If you want to disable memoization for a function, you can use the `enabled`
/// attribute to conditionally enable or disable memoization. This is useful for
/// situations where small calls are more expensive than recomputing the result.
/// This allows you to bypass hashing and caching while still dealing with the
/// same function signature. And allows saving memory and time.
///
/// By default, all functions are memoized. To disable memoization, you must
/// specify an `enabled = <expr>` attribute. The expression must evaluate to a
/// boolean value. If the expression is `false`, the function will be executed
/// without hashing and caching.
/// # Disabling memoization conditionally
/// If you want to enable or disable memoization for a function conditionally,
/// you can use the `enabled` attribute. This is useful for cheap function calls
/// where dealing with the caching is more expensive than recomputing the
/// result. This allows you to bypass hashing and constraint validation while
/// still dealing with the same function signature. And allows saving memory and
/// time.
///
/// By default, all functions are unconditionally memoized. To disable
/// memoization conditionally, you must specify an `enabled = <expr>` attribute.
/// The expression can use the parameters and must evaluate to a boolean value.
/// If the expression is `false`, the function will be executed without hashing
/// and caching.
///
/// ## Example
/// ```
Expand Down

0 comments on commit 74c3fff

Please sign in to comment.