{"id":19589024,"url":"https://github.com/shivankk26/rust-banking-system","last_synced_at":"2026-04-11T20:10:07.525Z","repository":{"id":219957940,"uuid":"750264398","full_name":"ShivankK26/Rust-Banking-System","owner":"ShivankK26","description":"This Rust program implements a basic banking system using Traits. It allows users to create accounts, deposit and withdraw money, and view their account balance.","archived":false,"fork":false,"pushed_at":"2024-01-31T13:59:02.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-26T13:29:12.209Z","etag":null,"topics":["cargo","cargo-generate","dev","git","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShivankK26.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-30T10:03:36.000Z","updated_at":"2024-01-31T12:10:09.000Z","dependencies_parsed_at":"2025-01-10T07:47:27.865Z","dependency_job_id":null,"html_url":"https://github.com/ShivankK26/Rust-Banking-System","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"e529c05deaaf75b4bd9bf1de53c558d8dce7c592"},"previous_names":["shivankk26/rust-banking-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ShivankK26/Rust-Banking-System","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivankK26%2FRust-Banking-System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivankK26%2FRust-Banking-System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivankK26%2FRust-Banking-System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivankK26%2FRust-Banking-System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShivankK26","download_url":"https://codeload.github.com/ShivankK26/Rust-Banking-System/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivankK26%2FRust-Banking-System/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31693318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo","cargo-generate","dev","git","rust","rust-lang"],"created_at":"2024-11-11T08:16:52.338Z","updated_at":"2026-04-11T20:10:07.511Z","avatar_url":"https://github.com/ShivankK26.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Banking System\n\nThis Rust program implements a basic banking system using Traits. It allows users to create accounts, deposit and withdraw money, and view their account balance.\n\n## Overview\n\nThe program consists of the following components:\n\n- **BankAccount Trait**: Defines operations for bank accounts such as deposit, withdraw, and balance.\n- **Account Struct**: Represents a bank account with fields for account number and balance.\n- **Implementation**: Implements the BankAccount trait for the Account struct, providing functionality for depositing, withdrawing, and checking balance.\n- **Main Function**: Demonstrates the usage of the Account struct by creating an account, performing deposit and withdrawal operations, and checking the balance.\n\n## Code Snippet\n\n```rust\n// Define a trait for bank operations\ntrait BankAccount {\n    fn deposit(\u0026mut self, amount: f64);\n    fn withdraw(\u0026mut self, amount: f64) -\u003e Result\u003c(), \u0026'static str\u003e;\n    fn balance(\u0026self) -\u003e f64;\n}\n\n// Define a struct to represent a bank account\nstruct Account {\n    account_number: u32,\n    balance: f64,\n}\n\n// Implement the BankAccount trait for the Account struct\nimpl BankAccount for Account {\n    fn deposit(\u0026mut self, amount: f64) {\n        self.balance += amount;\n        println!(\"Deposited {:.2} into account {}. New balance: {:.2}\", amount, self.account_number, self.balance);\n    }\n\n    fn withdraw(\u0026mut self, amount: f64) -\u003e Result\u003c(), \u0026'static str\u003e {\n        if self.balance \u003e= amount {\n            self.balance -= amount;\n            println!(\"Withdrawn {:.2} from account {}. New balance: {:.2}\", amount, self.account_number, self.balance);\n            Ok(())\n        } else {\n            Err(\"Insufficient funds\")\n        }\n    }\n\n    fn balance(\u0026self) -\u003e f64 {\n        self.balance\n    }\n}\n\nfn main() {\n    // Create a new account\n    let mut account = Account {\n        account_number: 123456,\n        balance: 1000.0,\n    };\n\n    println!(\"Account {} balance: {:.2}\", account.account_number, account.balance());\n\n    // Deposit some money\n    account.deposit(500.0);\n\n    // Withdraw some money\n    match account.withdraw(200.0) {\n        Ok(()) =\u003e println!(\"Withdrawal successful\"),\n        Err(err) =\u003e println!(\"Error: {}\", err),\n    }\n\n    // Attempt to withdraw more money than available\n    match account.withdraw(2000.0) {\n        Ok(()) =\u003e println!(\"Withdrawal successful\"),\n        Err(err) =\u003e println!(\"Error: {}\", err),\n    }\n\n    // Check balance\n    println!(\"Account {} balance: {:.2}\", account.account_number, account.balance());\n}\n```\n\n## Usage\n\nTo use the program, simply run the provided Rust code. The main function demonstrates the functionality of the banking system by creating an account, depositing and withdrawing money, and checking the account balance.\n\n## Cargo Commands\n\n- **Running the Application**: Use `cargo run` to compile and run the Rust application.\n- **Checking for Errors**: Use `cargo check` to check for errors in the code without building the application.\n- **Building the Application**: Use `cargo build` to build the Rust application without running it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivankk26%2Frust-banking-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshivankk26%2Frust-banking-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivankk26%2Frust-banking-system/lists"}