Message ID | 20221202161502.385525-15-ojeda@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp947825wrr; Fri, 2 Dec 2022 08:18:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Xk6CZ3aSEvtoNInUY0RYhp9JnbKXoI+KJHMGVgP/4CD0+ib6nhADeMI4vpDJGizH59A23 X-Received: by 2002:a63:eb16:0:b0:477:5f10:204f with SMTP id t22-20020a63eb16000000b004775f10204fmr46052712pgh.144.1669997916263; Fri, 02 Dec 2022 08:18:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669997916; cv=none; d=google.com; s=arc-20160816; b=Mh9UJDDHjLo1LBeMpwrx2u4MTxtujoHYKxpvT3vJEbIqn+AAiI6esJSY27ALU98apl JY9cnh17l+7FCMYNzjqKEzsk7EK559etYv7wMyudw1WYvBP7a8B2yKh+7BrUtxkpDRP1 dRnUpitLmg2egiSLZ45rf9M+Ppq4OAKuHzDfY6OVgu7nLWhk5QjnT4auLEek02bWFbGl jSSiKIViJZfxhObwIAW5QGUaBYPIgmP19XmxDROOgBtafvo92vvYrRrNzC2BJQRMwGcS GUigb8yslyuTtI7WtVV57P9lMg+TE4suaHjWLhM9qm91sqgL9bLUmHwx8HraeWAgnDyE h8Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8FrNuK0IkU0HL5bgRPrz8xUBzj5CJaBgy53d1Jgff8I=; b=snV5ywF1W5NZTgm8TyYc3h0KUlfzxCxGLDvxz6XR+zMbckWTLLhU5ax4ZOfgdjFY7L AX96U93wZWmZI4Wq8Yfkz137zOs6MdofoGuAUxDozrPnk3r5e8uW+9xrrl1YOK8giIht 8tUHG1eZSvuNBZBxA6KQkMTOLQK5EDccdlQymMvlEDAOPNSDJCbAm6+U/c03O2thduOv 9XEPi2G0Ytyaf5dwOpuMG8Cxx2AAkjs/sNoejRFtSM+a3+2Tk2AJGoQFFMud/e7V/B4X 8WhfGHYvfheLCwcqxjEzew6aKWWoapCNId6rWf/rQBeoXFK5YJ84WaSYAB258De59x2u 2C/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GSXqOdyv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a17090ab30c00b0021978dd7104si4787465pjr.89.2022.12.02.08.18.20; Fri, 02 Dec 2022 08:18:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GSXqOdyv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233664AbiLBQRO (ORCPT <rfc822;lhua1029@gmail.com> + 99 others); Fri, 2 Dec 2022 11:17:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233904AbiLBQQb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 2 Dec 2022 11:16:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4A3FD96A5; Fri, 2 Dec 2022 08:16:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 717F062321; Fri, 2 Dec 2022 16:16:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF922C433D6; Fri, 2 Dec 2022 16:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669997768; bh=H8GrOu07IRuGrUGFNBmi30U0LGPQsGBzhM2gPsNjUkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GSXqOdyvoi8n6XgrzYEVF4fhRH5tBbsPS7tPg3IrH4f/YUi3ehHMrKcQl2ulQ/Kop XEQoyYJuaPY9MWeMLa5swvgmArnT5mNqjne8069nzMrXH9An5X8Hsv9aa4fgWZruPw v5eiihrOunn5lnROLNG7vBCwouR95qcm+C7ctlR14lAs3iewozoi8RA31YmSBBfxzK KoOcheBvdRW7gelraQ/dzHya7zURlnBmn9909XlxyvrIg/Wg01jxUpxIOZDgXp8toF Q4DmdoaBMRV26zZjzNGTpwLmKwOx7hT1Fm6cKp2FDR/3/ZQAx/yZ6nnOrJ6EyUM/A8 wc7KBED35y1cw== From: ojeda@kernel.org To: Miguel Ojeda <ojeda@kernel.org>, Wedson Almeida Filho <wedsonaf@gmail.com>, Alex Gaynor <alex.gaynor@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com> Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH v2 14/28] rust: str: add `BStr` type Date: Fri, 2 Dec 2022 17:14:45 +0100 Message-Id: <20221202161502.385525-15-ojeda@kernel.org> In-Reply-To: <20221202161502.385525-1-ojeda@kernel.org> References: <20221202161502.385525-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751119735418382398?= X-GMAIL-MSGID: =?utf-8?q?1751119735418382398?= |
Series |
[v2,01/28] rust: prelude: split re-exports into groups
|
|
Commit Message
Miguel Ojeda
Dec. 2, 2022, 4:14 p.m. UTC
From: Gary Guo <gary@garyguo.net> Add the `BStr` type, which is a byte string without UTF-8 validity guarantee. It is simply an alias to `[u8]`, but has a more evident semantical meaning. Signed-off-by: Gary Guo <gary@garyguo.net> [Reworded, adapted for upstream and applied latest changes] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> --- rust/kernel/str.rs | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index e45ff220ae50..3aa1a0cb9bf8 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -4,6 +4,11 @@ use core::fmt; +/// Byte string without UTF-8 validity guarantee. +/// +/// `BStr` is simply an alias to `[u8]`, but has a more evident semantical meaning. +pub type BStr = [u8]; + /// Allows formatting of [`fmt::Arguments`] into a raw buffer. /// /// It does not fail if callers write past the end of the buffer so that they can calculate the