<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Protobuf on امین رشیدبیگی</title><link>https://aminrb.me/fa/tags/protobuf/</link><description>Recent content in Protobuf on امین رشیدبیگی</description><image><title>امین رشیدبیگی</title><url>https://aminrb.me/og-cover.jpg</url><link>https://aminrb.me/og-cover.jpg</link></image><generator>Hugo -- 0.148.2</generator><language>fa</language><lastBuildDate>Mon, 19 Aug 2024 19:33:13 +0000</lastBuildDate><atom:link href="https://aminrb.me/fa/tags/protobuf/index.xml" rel="self" type="application/rss+xml"/><item><title>چند وقت پیش فایل‌های Protocol Buffer پروژه‌ای رو…</title><link>https://aminrb.me/fa/telegram-40/</link><pubDate>Mon, 19 Aug 2024 19:33:13 +0000</pubDate><guid>https://aminrb.me/fa/telegram-40/</guid><description>&lt;p>چند وقت پیش فایل‌های Protocol Buffer پروژه‌ای رو مرتب‌ می‌کردم که دیدم این دو فیلد در بین چندین message پروژه تکرار شده:&lt;/p>
&lt;pre tabindex="0">&lt;code>message A {
    ...
    int64 seconds = n;
    int64 nano_seconds = m;
    ...
}
&lt;/code>&lt;/pre>&lt;p>با توجه به این که این دو خط عیناً تکرار شده بود، یک message تعریف کردم و به جای اون دوتا فیلد از message جدید استفاده کردم:&lt;/p>
&lt;pre tabindex="0">&lt;code>message Timestamp {
    int64 seconds = 1;
    int64 nano_seconds = 2;
}
message A {
    ...
    Timestamp timestamp_utc = p;
    ...
}
&lt;/code>&lt;/pre>&lt;p>بعداً متوجه شدم که &lt;code>Timestamp&lt;/code> هم یکی از تایپ‌هاییه که به صورت استاندارد تعریف شده و نیازی نیست خودمون تعریف کنیم. به همین خاطر message‌ها رو به دوباره بازنویسی کردم:&lt;/p></description></item></channel></rss>