Functional Weave
Code in Rust

property.holding-deposit-cap Unreviewed

Maximum holding deposit to reserve a rental property: one week's rent (annual rent ÷ 52), rounded down.

1.0.1 · published 2026-10-03 by charlie · Anterra

Pinned by 11 tests, run in TypeScript, Python and Rust.

Unreviewed. This capability’s implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified conveyancer or tax adviser has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

Not professional advice. This capability calculates property figures from published rules. It is a software component for developers, not legal or financial advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed in its README, and have a conveyancer or tax adviser review how you use it, before anyone relies on the output. Provided “as is” under its licence, without warranty.

What it does

The most a landlord or letting agent may take as a holding deposit to take a property off the market while references are checked: one week's rent.

One week's rent is the annual rent divided by 52, and annual rent is weekly rent × 52, monthly rent × 12, or the annual rent itself. £1,000 a month is £12,000 a year, so the cap is £230.76 (£230.769… rounded down). A weekly rent is its own cap exactly.

For example

  • holding_deposit_cap(£1,000.00, monthly) → £230.76 £1,000 a month: £230.76, rounded down from £230.769
  • holding_deposit_cap(£240.00, weekly) → £240.00 £240 a week (the guidance's example): exactly £240
  • holding_deposit_cap(£1,300.00, monthly) → £300.00 £1,300 a month is exactly £300 a week

The function

The same function in TypeScript, Python and Rust, pinned by the same tests. Pick your language; the choice follows you around the registry.

pub fn holding_deposit_cap(rent: &Money, rent_period: &str) -> Money
rentMoneythe total rent for the property (all joint tenants together), in GBP, zero or more
rent_periodRentPeriodwhat one payment of rent covers
returnsMoneyone week's rent: annual rent ÷ 52, rounded down to the penny

Your code names it in one line, in the file that uses it

fune!(property.holding-deposit-cap@^1);  // then call holding_deposit_cap(…)
impl/rust.rs · 33 lines · open · raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

use super::funejson::Value;  ← the fune runtime: the JSON value the test vectors use; fune build keeps it only where a signature takes one
use super::money_amount::{money, money_from_value, money_to_value, Money};  ← from money.amount ^1.0.0 · built alongside by fune

// Keeps annual rent exact as a JavaScript number; the same limit here.
const MAX_MINOR: i64 = 1_000_000_000_000;

/// One week's rent, the statutory maximum holding deposit: the annual rent
/// divided by 52, rounded down once so the deposit can never exceed the cap.
///
/// # Panics
/// Panics on rent not in GBP or negative, or an unknown rent period.
pub fn holding_deposit_cap(rent: &Money, rent_period: &str) -> Money {
    if rent.currency != "GBP" {
        panic!("rent must be in GBP, received {}", rent.currency);
    }
    if rent.minor < 0 {
        panic!("rent must not be negative, received {}", rent.minor);
    }
    let annual = match rent_period {
        "weekly" => rent.minor.checked_mul(52),
        "monthly" => rent.minor.checked_mul(12),
        "annual" => Some(rent.minor),
        other => panic!("unknown rent period \"{}\"", other),
    };
    match annual {
        Some(a) if a <= MAX_MINOR => money(a / 52, "GBP"),
        _ => panic!("annual rent must be at most {} minor units", MAX_MINOR),
    }
}

pub fn fune_vector(args: &[Value]) -> Value {
    money_to_value(&holding_deposit_cap(&money_from_value(&args[0]), args[1].as_str()))
}

Install

fune build

With that line in your source, in a Rust project (language rust in fune.project), fune build resolves it and its 2 dependencies, pins them in fune.lock, downloads only the Rust package of each, and builds the code above into your project’s .fune/build, one readable file per capability with a header linking back here. A crate’s build.rs runs it before every compile. Or pin a range in fune.project and build in one step:

fune add property.holding-deposit-cap
Download for Rust property.holding-deposit-cap-1.0.1-rust.fune · 8,897 bytes sha256 a6e3b8747efae3b37843d8068a8483531a55a368eaa1685dd8b7776d12547fec

The manifest, vectors and README with only the Rust implementation. Install it without the registry with fune add ./property.holding-deposit-cap-1.0.1-rust.fune, or fetch it from a terminal with fune pull property.holding-deposit-cap@1.0.1:rust.

The whole function, every language, is one file too: property.holding-deposit-cap-1.0.1.fune, 11,239 bytes, sha256 18782f7abf08ee38fcfae99fa5b97ff4c87979119dc200dae05ddd30544d6001. It installs into a project of any language.

Customise it in your app

The seams this capability offers. Put a marker directly above a function of your own and fune build wires it into the built code; the package on the registry is not changed, the built file’s header lists it under CUSTOMISED, and fune hooks lists every hook in the project. How hooks work.

before — your function gets the arguments and returns them, changed or not, or throws to refuse the call.

// fune: before property.holding-deposit-cap

after — your function gets the result and the arguments, and returns the final result.

// fune: after property.holding-deposit-cap

replace — inside this capability’s code only, calls to a dependency go to your function, with the same signature. Other capabilities that use it are unaffected; write in * to replace it everywhere.

// fune: replace money.amount in property.holding-deposit-cap
// fune: replace property.deposit-cap in property.holding-deposit-cap

step — your function runs at a numbered point inside the function’s body, receives the in-scope values it names as parameters, and may return replacements. List the points with fune show property.holding-deposit-cap --steps.

// fune: step property.holding-deposit-cap after <n|label>

Tests

A version published now needs at least 8 tests for every function, and one that expects the error for each function that throws; the registry refuses it otherwise. fune verify --all runs each case in TypeScript, Python and Rust, and a project runs them again with fune verify. This page lists the cases; it does not run them. The exact JSON is vectors.json.

CaseArgumentsExpected
£1,000 a month: £230.76, rounded down from £230.769 £1,000.00, monthly → £230.76
£240 a week (the guidance's example): exactly £240 £240.00, weekly → £240.00
£1,300 a month is exactly £300 a week £1,300.00, monthly → £300.00
£26,000 a year is exactly £500 a week £26,000.00, annual → £500.00
£25,999.99 a year rounds down to £499.99 £25,999.99, annual → £499.99
not a quarter of the monthly rent: £1,500 a month is £346.15, not £375 £1,500.00, monthly → £346.15
a penny a month rounds down to nothing £0.01, monthly → £0.00
zero rent £0.00, weekly → £0.00
rent in euros is refused €1,000.00, monthly → error: rent must be in GBP
negative rent is refused -£1.00, monthly → error: rent must not be negative
Show the other 1 test
CaseArgumentsExpected
an unknown rent period is refused £1,000.00, quarterly → error: unknown rent period

More from the author

## Why it is shaped this way

- **Rounded down, once.** Neither Act states a rounding rule; rounding up would put the deposit a fraction of a penny over the statutory maximum, so the only safe answer is down. - **Total rent, not per tenant.** For a joint tenancy the cap is one week of the rent the tenants are jointly liable for, and the guidance is explicit that a landlord cannot take a week's rent from each tenant. - **No date argument.** The cap has been one week's rent since it was introduced (England from 1 June 2019, Wales from 1 September 2019) and has not changed; the Renters' Rights Act 2025 left it as it was. If it ever changes, it becomes dated data in a new version. - The rent period type is `RentPeriod` from property.deposit-cap, so the two calculations accept the same inputs.

## What it does not do

It does not decide whether a holding deposit may be kept or must be repaid (the 15-day deadline for agreement and its exceptions), and it does not apply to Scotland, where holding deposits are treated differently.

## Sources

- Tenant Fees Act 2019, Schedule 1 paragraph 3 (holding deposit: at most one week's rent, being the annual rent divided by 52): https://www.legislation.gov.uk/ukpga/2019/4/schedule/1 - "Tenant Fees Act 2019: statutory guidance for enforcement authorities" (as amended by the Renters' Rights Act 2025; the joint-tenancy example, a weekly rent of £240 allows one £240 holding deposit in total): https://www.gov.uk/government/publications/tenant-fees-act-amended-by-the-renters-rights-act-2025/tenant-fees-act-2019-statutory-guidance-for-enforcement-authorities - Renting Homes (Fees etc.) (Wales) Act 2019, Schedule 2 (holding deposit of no more than one week's rent): https://www.legislation.gov.uk/anaw/2019/2/schedule/2

## Before you rely on this

**Not professional advice.** This capability calculates property figures from published rules. It is a software component for developers, not legal or financial advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed above, and have a conveyancer or tax adviser review how you use it, before anyone relies on the output. Provided "as is" under its licence, without warranty.

**Unreviewed.** This capability's implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified conveyancer or tax adviser has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

1.0.1 marks it unreviewed. The code and the tests are unchanged.

Files

PathBytes
README.md3,364
impl/python.py1,066
impl/rust.rs1,278
impl/typescript.ts1,150
vectors.json2,150