{"id":16244265,"url":"https://github.com/doumanash/clipboard-win","last_synced_at":"2025-04-06T03:08:56.218Z","repository":{"id":45180737,"uuid":"38964401","full_name":"DoumanAsh/clipboard-win","owner":"DoumanAsh","description":"Rust win clipboard utilities","archived":false,"fork":false,"pushed_at":"2024-04-16T12:25:25.000Z","size":168,"stargazers_count":49,"open_issues_count":3,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-02T00:09:59.032Z","etag":null,"topics":["clipboard","winapi"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/clipboard-win","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DoumanAsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2015-07-12T14:19:27.000Z","updated_at":"2024-06-19T00:04:40.150Z","dependencies_parsed_at":"2024-02-19T17:23:44.637Z","dependency_job_id":"66f86be6-8bcc-4c49-aded-f5d7fd3ba2f8","html_url":"https://github.com/DoumanAsh/clipboard-win","commit_stats":{"total_commits":29,"total_committers":4,"mean_commits":7.25,"dds":"0.10344827586206895","last_synced_commit":"44487b19cd12a9242f5b1991c088bf81c780f172"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoumanAsh%2Fclipboard-win","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoumanAsh%2Fclipboard-win/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoumanAsh%2Fclipboard-win/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoumanAsh%2Fclipboard-win/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DoumanAsh","download_url":"https://codeload.github.com/DoumanAsh/clipboard-win/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["clipboard","winapi"],"created_at":"2024-10-10T14:18:19.171Z","updated_at":"2025-04-06T03:08:56.198Z","avatar_url":"https://github.com/DoumanAsh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"clipboard-win\r\n====================\r\n\r\n![Build](https://github.com/DoumanAsh/clipboard-win/workflows/Rust/badge.svg)\r\n[![Crates.io](https://img.shields.io/crates/v/clipboard-win.svg)](https://crates.io/crates/clipboard-win)\r\n[![Docs.rs](https://docs.rs/clipboard-win/badge.svg)](https://docs.rs/clipboard-win/*/x86_64-pc-windows-msvc/clipboard_win/)\r\n\r\nThis crate provide simple means to operate with Windows clipboard.\r\n\r\n# Note keeping Clipboard around:\r\n\r\nIn Windows [Clipboard](struct.Clipboard.html) opens globally and only one application can set data onto format at the time.\r\n\r\nTherefore as soon as operations are finished, user is advised to close [Clipboard](struct.Clipboard.html).\r\n\r\n# Clipboard\r\n\r\nAll read and write access to Windows clipboard requires user to open it.\r\n\r\n# Usage\r\n\r\n## Manually lock clipboard\r\n\r\n```rust\r\nuse clipboard_win::{Clipboard, formats, Getter, Setter};\r\n\r\nconst SAMPLE: \u0026str = \"MY loli sample ^^\";\r\n\r\nlet _clip = Clipboard::new_attempts(10).expect(\"Open clipboard\");\r\nformats::Unicode.write_clipboard(\u0026SAMPLE).expect(\"Write sample\");\r\n\r\nlet mut output = String::new();\r\n\r\nassert_eq!(formats::Unicode.read_clipboard(\u0026mut output).expect(\"Read sample\"), SAMPLE.len());\r\nassert_eq!(output, SAMPLE);\r\n\r\n//Efficiently re-use buffer ;)\r\noutput.clear();\r\nassert_eq!(formats::Unicode.read_clipboard(\u0026mut output).expect(\"Read sample\"), SAMPLE.len());\r\nassert_eq!(output, SAMPLE);\r\n\r\n//Or take the same string twice?\r\nassert_eq!(formats::Unicode.read_clipboard(\u0026mut output).expect(\"Read sample\"), SAMPLE.len());\r\nassert_eq!(format!(\"{0}{0}\", SAMPLE), output);\r\n\r\n```\r\n\r\n## Simplified API\r\n\r\n```rust\r\nuse clipboard_win::{formats, get_clipboard, set_clipboard};\r\n\r\nlet text = \"my sample \u003e\u003c\";\r\n\r\nset_clipboard(formats::Unicode, text).expect(\"To set clipboard\");\r\n//Type is necessary as string can be stored in various storages\r\nlet result: String = get_clipboard(formats::Unicode).expect(\"To set clipboard\");\r\nassert_eq!(result, text)\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoumanash%2Fclipboard-win","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoumanash%2Fclipboard-win","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoumanash%2Fclipboard-win/lists"}